Class: EacRubyUtils::Listable::Lists
- Inherits:
-
Object
- Object
- EacRubyUtils::Listable::Lists
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.
13
14
15
|
# File 'lib/eac_ruby_utils/listable/lists.rb', line 13
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
31
32
33
34
|
# File 'lib/eac_ruby_utils/listable/lists.rb', line 31
def method_missing(name, *args, &block)
list = find_list_by_method(name)
list ? list : super
end
|
Instance Attribute Details
Returns the value of attribute source.
11
12
13
|
# File 'lib/eac_ruby_utils/listable/lists.rb', line 11
def source
@source
end
|
Instance Method Details
#acts_as_listable_items ⇒ Object
40
41
42
|
# File 'lib/eac_ruby_utils/listable/lists.rb', line 40
def acts_as_listable_items
@acts_as_listable_items ||= ActiveSupport::HashWithIndifferentAccess.new
end
|
#add_integer(item, *labels) ⇒ Object
17
18
19
20
21
22
|
# File 'lib/eac_ruby_utils/listable/lists.rb', line 17
def add_integer(item, *labels)
check_acts_as_listable_new_item(item)
acts_as_listable_items[item] = ::EacRubyUtils::Listable::IntegerList.new(
self, item, labels
)
end
|
#add_string(item, *labels) ⇒ Object
24
25
26
27
28
29
|
# File 'lib/eac_ruby_utils/listable/lists.rb', line 24
def add_string(item, *labels)
check_acts_as_listable_new_item(item)
acts_as_listable_items[item] = ::EacRubyUtils::Listable::StringList.new(
self, item, labels
)
end
|
#respond_to_missing?(name, include_all = false) ⇒ Boolean
36
37
38
|
# File 'lib/eac_ruby_utils/listable/lists.rb', line 36
def respond_to_missing?(name, include_all = false)
find_list_by_method(name) || super
end
|