Class: Padrino::Decorator::Base
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Padrino::Decorator::Base
- Defined in:
- lib/padrino-decorator/base.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #class ⇒ Object
- #decorated? ⇒ Boolean
-
#initialize(object, options = {}) ⇒ Base
constructor
A new instance of Base.
- #instance_of?(klass) ⇒ Boolean
- #kind_of?(klass) ⇒ Boolean (also: #is_a?)
- #to_model ⇒ Object
Constructor Details
#initialize(object, options = {}) ⇒ Base
Returns a new instance of Base.
8 9 10 11 12 |
# File 'lib/padrino-decorator/base.rb', line 8 def initialize(object, = {}) @object = object @context = [:context] super(object) end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
6 7 8 |
# File 'lib/padrino-decorator/base.rb', line 6 def object @object end |
Instance Method Details
#class ⇒ Object
18 19 20 |
# File 'lib/padrino-decorator/base.rb', line 18 def class to_model.class end |
#decorated? ⇒ Boolean
31 32 33 |
# File 'lib/padrino-decorator/base.rb', line 31 def decorated? true end |
#instance_of?(klass) ⇒ Boolean
27 28 29 |
# File 'lib/padrino-decorator/base.rb', line 27 def instance_of?(klass) to_model.instance_of?(klass) end |
#kind_of?(klass) ⇒ Boolean Also known as: is_a?
22 23 24 |
# File 'lib/padrino-decorator/base.rb', line 22 def kind_of?(klass) to_model.kind_of?(klass) end |
#to_model ⇒ Object
14 15 16 |
# File 'lib/padrino-decorator/base.rb', line 14 def to_model __getobj__ end |