Class: EacRubyUtils::Listable::Lists

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_ruby_utils/listable/lists.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ Lists

Returns a new instance of Lists.



14
15
16
# File 'lib/eac_ruby_utils/listable/lists.rb', line 14

def initialize(source)
  @source = source
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



24
25
26
27
# File 'lib/eac_ruby_utils/listable/lists.rb', line 24

def method_missing(name, *args, &block)
  list = find_list_by_method(name)
  list || super
end

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



12
13
14
# File 'lib/eac_ruby_utils/listable/lists.rb', line 12

def source
  @source
end

Instance Method Details

#acts_as_listable_itemsObject



33
34
35
# File 'lib/eac_ruby_utils/listable/lists.rb', line 33

def acts_as_listable_items
  @acts_as_listable_items ||= ActiveSupport::HashWithIndifferentAccess.new
end

#respond_to_missing?(name, include_all = false) ⇒ Boolean

Returns:



29
30
31
# File 'lib/eac_ruby_utils/listable/lists.rb', line 29

def respond_to_missing?(name, include_all = false)
  find_list_by_method(name) || super
end