Class: Granite::Action::Precondition
- Inherits:
- BasicObject
- Defined in:
- lib/granite/action/precondition.rb
Overview
:nodoc:
Constant Summary collapse
- UNDEFINED =
::Object.new.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(context) ⇒ Precondition
constructor
A new instance of Precondition.
- #method_missing(method_name, *args, &blk) ⇒ Object
- #respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
Constructor Details
#initialize(context) ⇒ Precondition
Returns a new instance of Precondition.
15 16 17 |
# File 'lib/granite/action/precondition.rb', line 15 def initialize(context) @context = context end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &blk) ⇒ Object
23 24 25 26 27 |
# File 'lib/granite/action/precondition.rb', line 23 def method_missing(method_name, *args, &blk) super unless @context.respond_to?(method_name) @context.__send__(method_name, *args, &blk) end |
Class Method Details
Instance Method Details
#call ⇒ Object
19 20 21 |
# File 'lib/granite/action/precondition.rb', line 19 def call(*) raise NotImplementedError, "#call method must be implemented for #{self.class}" end |
#respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
29 30 31 |
# File 'lib/granite/action/precondition.rb', line 29 def respond_to_missing?(method_name, _include_private = false) @context.respond_to?(method_name) end |