Class: Riveter::Presenter::Base
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Riveter::Presenter::Base
show all
- Defined in:
- lib/riveter/presenter.rb
Instance Method Summary
collapse
Constructor Details
#initialize(item, view = nil) ⇒ Base
Returns a new instance of Base.
42
43
44
45
|
# File 'lib/riveter/presenter.rb', line 42
def initialize(item, view=nil)
super(item)
@view = view
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/riveter/presenter.rb', line 47
def method_missing(method, *args, &block)
return super if @view.nil?
if respond_to_without_view?(method)
super
elsif @view.respond_to?(method)
@view.send(method, *args, &block)
else
super
end
end
|
Instance Method Details
38
39
40
|
# File 'lib/riveter/presenter.rb', line 38
def item
__getobj__
end
|
#respond_to_with_view?(method) ⇒ Boolean
59
60
61
|
# File 'lib/riveter/presenter.rb', line 59
def respond_to_with_view?(method)
respond_to_without_view?(method) || (!@view.nil? && @view.respond_to?(method))
end
|