fluke/devops-client/lib/devops-client/output/bootstrap_templates.rb
GGA Software Services LLC 02bf8b1bba initial commit
2014-05-08 17:06:06 +04:00

35 lines
678 B
Ruby

require "devops-client/output/base"
module Output
module BootstrapTemplates
include Base
def table
headers, rows = create(@list)
create_table(headers, rows, I18n.t("output.title.bootstrap_template.list"))
end
def csv
headers, rows = create(@list)
create_csv(headers, rows)
end
def json
JSON.pretty_generate @list
end
private
def create list
abort I18n.t("output.not_found.bootstrap_template.list") if list.nil? or list.empty?
headers = [ I18n.t("output.table_header.name") ]
rows = []
list.each do |l|
rows.push [ l ]
end
return headers, rows
end
end
end