Module: Octonaut::Printers::Users
- Included in:
- Octonaut::Printer
- Defined in:
- lib/octonaut/printers/users.rb
Constant Summary collapse
- USER_FIELDS =
{ "id" => "ID", "login" => "LOGIN", "name" => "NAME", "company" => "COMPANY", "location" => "LOCATION", "followers" => "FOLLOWERS", "following" => "FOLLOWING", "hireable" => "HIREABLE", "blog" => "URL", "created_at" => "JOINED" }
Instance Method Summary collapse
- #ls_users(users, options = {}) ⇒ Object
- #print_csv_users(users, options = {}) ⇒ Object
- #print_user_table(user, options = {}) ⇒ Object
- #print_users(users, options = {}) ⇒ Object
Instance Method Details
#ls_users(users, options = {}) ⇒ Object
36 37 38 |
# File 'lib/octonaut/printers/users.rb', line 36 def ls_users(users, = {}) users.each {|u| puts u.login } end |
#print_csv_users(users, options = {}) ⇒ Object
31 32 33 34 |
# File 'lib/octonaut/printers/users.rb', line 31 def print_csv_users(users, = {}) [:fields] = USER_FIELDS print_csv users, end |
#print_user_table(user, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/octonaut/printers/users.rb', line 18 def print_user_table(user, = {}) data = {} USER_FIELDS.each do |field, heading| data[heading] = user[field] end print_table(data) end |
#print_users(users, options = {}) ⇒ Object
27 28 29 |
# File 'lib/octonaut/printers/users.rb', line 27 def print_users(users, = {}) [:csv] ? print_csv_users(users) : ls_users(users) end |