Class: Padrino::Decorator::Base

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/padrino-decorator/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options = {})
  @object = object
  @context = options[:context]
  super(object)
end

Instance Attribute Details

#objectObject (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

#classObject



18
19
20
# File 'lib/padrino-decorator/base.rb', line 18

def class
  to_model.class
end

#decorated?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/padrino-decorator/base.rb', line 31

def decorated?
  true
end

#instance_of?(klass) ⇒ Boolean

Returns:

  • (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?

Returns:

  • (Boolean)


22
23
24
# File 'lib/padrino-decorator/base.rb', line 22

def kind_of?(klass)
  to_model.kind_of?(klass)
end

#to_modelObject



14
15
16
# File 'lib/padrino-decorator/base.rb', line 14

def to_model
  __getobj__
end