Class: Presenter
- Inherits:
-
Object
- Object
- Presenter
- Defined in:
- lib/pres/presenter.rb
Overview
Base Presenter class Construct with object, view_context, and optional options
Instance Attribute Summary collapse
-
#object ⇒ Object
Returns the value of attribute object.
-
#options ⇒ Object
Returns the value of attribute options.
-
#view_context ⇒ Object
Returns the value of attribute view_context.
Instance Method Summary collapse
-
#initialize(object, view_context = nil, options = {}) ⇒ Presenter
constructor
A new instance of Presenter.
-
#method_missing(symbol, *args, &block) ⇒ Object
Send missing symbols to view_context.
- #respond_to?(symbol, _ = false) ⇒ Boolean
Constructor Details
#initialize(object, view_context = nil, options = {}) ⇒ Presenter
Returns a new instance of Presenter.
8 9 10 11 12 |
# File 'lib/pres/presenter.rb', line 8 def initialize(object, view_context = nil, = {}) self.object = object self.view_context = view_context self. = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args, &block) ⇒ Object
Send missing symbols to view_context
15 16 17 |
# File 'lib/pres/presenter.rb', line 15 def method_missing(symbol, *args, &block) view_context.send(symbol, *args, &block) end |
Instance Attribute Details
#object ⇒ Object
Returns the value of attribute object.
4 5 6 |
# File 'lib/pres/presenter.rb', line 4 def object @object end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/pres/presenter.rb', line 4 def end |
#view_context ⇒ Object
Returns the value of attribute view_context.
4 5 6 |
# File 'lib/pres/presenter.rb', line 4 def view_context @view_context end |
Instance Method Details
#respond_to?(symbol, _ = false) ⇒ Boolean
19 20 21 |
# File 'lib/pres/presenter.rb', line 19 def respond_to?(symbol, _ = false) super || view_context.respond_to?(symbol, true) end |