Sha256: 4e1d12f8c549174c587620dd433546b1b5362534411cb1f6726827670cbfad78

Contents?: true

Size: 701 Bytes

Versions: 4

Compression:

Stored size: 701 Bytes

Contents

module TableFor
  module HelperMethods
    def table_for_options(options={}, parameters={})
      evaluated_options = {}
      options.each_pair { |k, v| evaluated_options[k] = (v.is_a?(Proc) ? v.call(parameters) : v)}
      evaluated_options
    end
    
    def table_for(records, options={}, &block)
      options[:records] = records
      options[:row_html] = {:class => lambda { |parameters| cycle('odd', 'even')}} if options[:row_html].nil?
      options[:template] = "table_for/table_for"
      options[:templates_folder] = "table_for"
      options[:record_variable] = "records"
      options[:variable] = "table"
      
      TableFor::Base.new(self, options, &block).render
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
table-for-0.0.16 lib/table_for/helper_methods.rb
table-for-0.0.15 lib/table_for/helper_methods.rb
table-for-0.0.14 lib/table_for/helper_methods.rb
table-for-0.0.13 lib/table_for/helper_methods.rb