class Hirb::Formatter

A Formatter object formats an output object (using Formatter.format_output) into a string based on the views defined for its class and/or ancestry.

Public Instance Methods

determine_output_class(output) click to toggle source
# File lib/ez.rb, line 59
def determine_output_class(output)
  if output.respond_to?(:to_a) && to_a_classes.any? {|e| output.is_a?(e) }
    Array(output)[0].class
  else
    if output.is_a?(ActiveRecord::Base)
      Hash
    else
      output.class
    end
  end
end