Module: Octonaut::Printers::Organizations
- Defined in:
- lib/octonaut/printers/organizations.rb
Constant Summary collapse
- ORG_FIELDS =
{ "id" => "ID", "created_at" => "JOINED", "login" => "LOGIN", "name" => "NAME", "location" => "LOCATION", "blog" => "URL" }
Instance Method Summary collapse
- #ls_orgs(orgs, options = {}) ⇒ Object
- #print_csv_orgs(orgs, options = {}) ⇒ Object
- #print_org_table(org, options = {}) ⇒ Object
- #print_orgs(orgs, options = {}) ⇒ Object
Instance Method Details
#ls_orgs(orgs, options = {}) ⇒ Object
32 33 34 |
# File 'lib/octonaut/printers/organizations.rb', line 32 def ls_orgs(orgs, = {}) orgs.each {|o| puts o.login } end |
#print_csv_orgs(orgs, options = {}) ⇒ Object
27 28 29 30 |
# File 'lib/octonaut/printers/organizations.rb', line 27 def print_csv_orgs(orgs, = {}) [:fields] = ORG_FIELDS print_csv orgs, end |
#print_org_table(org, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/octonaut/printers/organizations.rb', line 14 def print_org_table(org, = {}) data = {} ORG_FIELDS.each do |field, heading| data[heading] = org[field] end print_table(data) end |
#print_orgs(orgs, options = {}) ⇒ Object
23 24 25 |
# File 'lib/octonaut/printers/organizations.rb', line 23 def print_orgs(orgs, = {}) [:csv] ? print_csv_orgs(orgs) : ls_orgs(orgs) end |