Class: Eac::Listable::Lists
- Inherits:
-
Object
- Object
- Eac::Listable::Lists
show all
- Defined in:
- lib/eac/listable.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(source) ⇒ Lists
Returns a new instance of Lists.
45
46
47
|
# File 'lib/eac/listable.rb', line 45
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
63
64
65
66
|
# File 'lib/eac/listable.rb', line 63
def method_missing(name, *args, &block)
list = find_list_by_method(name)
list ? list : super
end
|
Instance Attribute Details
#source ⇒ Object
Returns the value of attribute source.
43
44
45
|
# File 'lib/eac/listable.rb', line 43
def source
@source
end
|
Instance Method Details
#acts_as_listable_items ⇒ Object
72
73
74
|
# File 'lib/eac/listable.rb', line 72
def acts_as_listable_items
@acts_as_listable_items ||= ActiveSupport::HashWithIndifferentAccess.new
end
|
#add_integer(item, *labels) ⇒ Object
49
50
51
52
53
54
|
# File 'lib/eac/listable.rb', line 49
def add_integer(item, *labels)
check_acts_as_listable_new_item(item)
acts_as_listable_items[item] = ::Eac::Listable::IntegerList.new(
self, item, labels
)
end
|
#add_string(item, *labels) ⇒ Object
56
57
58
59
60
61
|
# File 'lib/eac/listable.rb', line 56
def add_string(item, *labels)
check_acts_as_listable_new_item(item)
acts_as_listable_items[item] = ::Eac::Listable::StringList.new(
self, item, labels
)
end
|
#respond_to?(name, include_all = false) ⇒ Boolean
68
69
70
|
# File 'lib/eac/listable.rb', line 68
def respond_to?(name, include_all = false)
find_list_by_method(name) || super
end
|