Class: DecentDecoration::Decoration
- Inherits:
-
Object
- Object
- DecentDecoration::Decoration
- Defined in:
- lib/decent_decoration/decorate.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#original_options ⇒ Object
writeonly
Sets the attribute original_options.
Instance Method Summary collapse
- #decorate_method ⇒ Object
- #decorated_name ⇒ Object
- #decorator_class ⇒ Object
-
#initialize(name, options = {}) ⇒ Decoration
constructor
A new instance of Decoration.
- #options ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ Decoration
Returns a new instance of Decoration.
6 7 8 9 |
# File 'lib/decent_decoration/decorate.rb', line 6 def initialize(name, = {}) self.name = name self. = end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/decent_decoration/decorate.rb', line 3 def name @name end |
#original_options=(value) ⇒ Object
Sets the attribute original_options
3 4 5 |
# File 'lib/decent_decoration/decorate.rb', line 3 def (value) @original_options = value end |
Instance Method Details
#decorate_method ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/decent_decoration/decorate.rb', line 23 def decorate_method if decorate_collection? && decorator_class.respond_to?(:decorate_collection) :decorate_collection elsif decorator_class.respond_to?(:decorate) :decorate else :new end end |
#decorated_name ⇒ Object
11 12 13 |
# File 'lib/decent_decoration/decorate.rb', line 11 def decorated_name "decorated_#{name}".to_sym end |
#decorator_class ⇒ Object
19 20 21 |
# File 'lib/decent_decoration/decorate.rb', line 19 def decorator_class .fetch(:decorator) { infer_decorator_class } end |
#options ⇒ Object
15 16 17 |
# File 'lib/decent_decoration/decorate.rb', line 15 def .except(:decorator, :collection) end |