Class: AdequateExposure::Flow
- Inherits:
-
Object
- Object
- AdequateExposure::Flow
- Defined in:
- lib/adequate_exposure/flow.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(controller, options) ⇒ Flow
constructor
Public: Initialize a Flow.
-
#method_missing(name, *args, &block) ⇒ Object
Public: Attempts to re-delegate a method missing to the supplied block or the Behavior object.
-
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Public: Checks if the Behavior class can handle the missing method.
Constructor Details
#initialize(controller, options) ⇒ Flow
Public: Initialize a Flow. This object responds to missing methods errors and attempts to delegate them to other objects.
controller - The Controller class where the method was called. options - The options Hash of the Exposure instance being called. name - The String name of the Exposure instance.
11 12 13 14 15 |
# File 'lib/adequate_exposure/flow.rb', line 11 def initialize(controller, ) @controller = controller = @name = .fetch(:name) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
Public: Attempts to re-delegate a method missing to the supplied block or the Behavior object.
name - The String name of the Exposure instance. *args - The arguments given for the missing method. block - The Proc invoked by the method.
23 24 25 26 27 28 29 |
# File 'lib/adequate_exposure/flow.rb', line 23 def method_missing(name, *args, &block) if respond_to_missing?(name) handle_flow_method(name, *args, &block) else super end end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
3 4 5 |
# File 'lib/adequate_exposure/flow.rb', line 3 def controller @controller end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/adequate_exposure/flow.rb', line 3 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/adequate_exposure/flow.rb', line 3 def end |
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Public: Checks if the Behavior class can handle the missing method.
method_name - The name of method that has been called. include_private - Prevents this method from catching calls to private method (default: false).
36 37 38 |
# File 'lib/adequate_exposure/flow.rb', line 36 def respond_to_missing?(method_name, include_private = false) Behavior.method_defined?(method_name) || super end |