Class: Referral::PrintsResults
- Inherits:
-
Object
- Object
- Referral::PrintsResults
- Defined in:
- lib/referral/prints_results.rb
Instance Method Summary collapse
Instance Method Details
#call(result, options) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/referral/prints_results.rb', line 53 def call(result, ) if [:print_headers] puts [:columns].join([:delimiter]) end result.tokens.each do |token| cells = [:columns].map { |column_name| if (column = COLUMN_FUNCTIONS[column_name.to_sym]) column.call(token) else raise Referral::Error.new("Column '#{column_name}' not found in Referral::COLUMN_FUNCTIONS") end } puts cells.join([:delimiter]) end end |