Class: Light::Decorator::Decorate
- Inherits:
-
Object
- Object
- Light::Decorator::Decorate
- Defined in:
- lib/light/decorator/decorate.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
(also: #o)
readonly
Original object.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#decorated? ⇒ Bool
Check current ActiveRecord::Model is decorated or not.
- #eql?(other) ⇒ Boolean
-
#helpers ⇒ ActionView::Base
(also: #h)
Current view scope.
-
#initialize(object, options = {}) ⇒ Object
constructor
Decorate the object.
Constructor Details
#initialize(object, options = {}) ⇒ Object
Decorate the object
13 14 15 16 17 18 19 |
# File 'lib/light/decorator/decorate.rb', line 13 def initialize(object, = {}) @object = object @options = delegate_methods decorate_associations end |
Instance Attribute Details
#object ⇒ Object (readonly) Also known as: o
Returns original object.
5 6 7 |
# File 'lib/light/decorator/decorate.rb', line 5 def object @object end |
Instance Method Details
#==(other) ⇒ Object
36 37 38 |
# File 'lib/light/decorator/decorate.rb', line 36 def ==(other) super || object == other end |
#decorated? ⇒ Bool
Check current ActiveRecord::Model is decorated or not
24 25 26 |
# File 'lib/light/decorator/decorate.rb', line 24 def decorated? true end |
#eql?(other) ⇒ Boolean
40 41 42 |
# File 'lib/light/decorator/decorate.rb', line 40 def eql?(other) super || object.eql?(other) end |
#helpers ⇒ ActionView::Base Also known as: h
Current view scope
31 32 33 34 |
# File 'lib/light/decorator/decorate.rb', line 31 def helpers return @helpers if defined?(@helpers) @helpers = Light::Decorator::ViewContext.current end |