Sha256: 01f5e33850f179f9d6eabe863312bac3cf482b4190372bd3f2ddbe7b539ae16d

Contents?: true

Size: 618 Bytes

Versions: 4

Compression:

Stored size: 618 Bytes

Contents

module ListFor
  module HelperMethods
    def list_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 list_for(*args, &block)
      options = args.extract_options! 
      
      options[:records] = args.first
      options[:template] = "list_for/list_for"
      options[:templates_folder] = "list_for"
      options[:record_variable] = "records"
      options[:variable] = "list"
      
      ListFor::Base.new(self, options, &block).render
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
list-for-0.0.4 lib/list_for/helper_methods.rb
list-for-0.0.3 lib/list_for/helper_methods.rb
list-for-0.0.2 lib/list_for/helper_methods.rb
list-for-0.0.1 lib/list_for/helper_methods.rb