Sha256: 644911daa92e3f7c41321e88daca2aee98a7b127e105f2ccd4c4db0a6e050488
Contents?: true
Size: 556 Bytes
Versions: 2
Compression:
Stored size: 556 Bytes
Contents
# Detects the table class the output should use and delegates rendering to it. class Hirb::Helpers::AutoTable # Same options as Hirb::Helpers::Table.render. def self.render(output, options={}) options[:_original_class] = output.class output = Array(output) klass = if (output[0].is_a?(ActiveRecord::Base) rescue false) Hirb::Helpers::ActiveRecordTable elsif !(output[0].is_a?(Hash) || output[0].is_a?(Array)) Hirb::Helpers::ObjectTable else Hirb::Helpers::Table end klass.render(output, options) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hirb-0.2.10 | lib/hirb/helpers/auto_table.rb |
hirb-0.2.9 | lib/hirb/helpers/auto_table.rb |