Class: Positionable::Wrapper
- Inherits:
-
Object
- Object
- Positionable::Wrapper
- Defined in:
- lib/positionable.rb
Overview
Wrapper class for all the lists’ options
Instance Attribute Summary collapse
-
#lists ⇒ Object
Returns the value of attribute lists.
Instance Method Summary collapse
- #<<(options = {}) ⇒ Object
- #conditions(list_name) ⇒ Object
- #has_conditions?(list_name) ⇒ Boolean
- #has_scope?(list_name) ⇒ Boolean
-
#initialize ⇒ Wrapper
constructor
A new instance of Wrapper.
- #scope(list_name) ⇒ Object
Constructor Details
#initialize ⇒ Wrapper
Returns a new instance of Wrapper.
93 94 95 |
# File 'lib/positionable.rb', line 93 def initialize self.lists = {} end |
Instance Attribute Details
#lists ⇒ Object
Returns the value of attribute lists.
92 93 94 |
# File 'lib/positionable.rb', line 92 def lists @lists end |
Instance Method Details
#<<(options = {}) ⇒ Object
97 98 99 100 |
# File 'lib/positionable.rb', line 97 def <<(={}) [:conditions_to_eval] = Positionable::EvalSupport.conditions_to_eval([:conditions]) self.lists[.delete(:list_name)] = end |
#conditions(list_name) ⇒ Object
114 115 116 |
# File 'lib/positionable.rb', line 114 def conditions(list_name) lists[list_name][:conditions] end |
#has_conditions?(list_name) ⇒ Boolean
110 111 112 |
# File 'lib/positionable.rb', line 110 def has_conditions?(list_name) !!lists[list_name][:conditions] end |
#has_scope?(list_name) ⇒ Boolean
102 103 104 |
# File 'lib/positionable.rb', line 102 def has_scope?(list_name) !!lists[list_name][:scope] end |
#scope(list_name) ⇒ Object
106 107 108 |
# File 'lib/positionable.rb', line 106 def scope(list_name) lists[list_name][:scope].is_a?(Array) ? lists[list_name][:scope] : [lists[list_name][:scope]] end |