Class: Middleman::CoreExtensions::Collections::StepContext
- Inherits:
-
Object
- Object
- Middleman::CoreExtensions::Collections::StepContext
- Defined in:
- middleman-core/lib/middleman-core/core_extensions/collections/step_context.rb
Class Attribute Summary collapse
-
.current ⇒ Object
Returns the value of attribute current.
Instance Attribute Summary collapse
-
#descriptors ⇒ Object
readonly
Returns the value of attribute descriptors.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(app) ⇒ StepContext
constructor
A new instance of StepContext.
- #method_missing(name, *args, &block) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(app) ⇒ StepContext
Returns a new instance of StepContext.
17 18 19 20 |
# File 'middleman-core/lib/middleman-core/core_extensions/collections/step_context.rb', line 17 def initialize(app) @app = app @descriptors = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'middleman-core/lib/middleman-core/core_extensions/collections/step_context.rb', line 22 def method_missing(name, *args, &block) internal = :"_internal_#{name}" if respond_to?(internal) send(internal, *args, &block).tap do |r| @descriptors << r if r.respond_to?(:execute_descriptor) end else @app.config_context.send(name, *args, &block) end end |
Class Attribute Details
.current ⇒ Object
Returns the value of attribute current.
8 9 10 |
# File 'middleman-core/lib/middleman-core/core_extensions/collections/step_context.rb', line 8 def current @current end |
Instance Attribute Details
#descriptors ⇒ Object (readonly)
Returns the value of attribute descriptors.
15 16 17 |
# File 'middleman-core/lib/middleman-core/core_extensions/collections/step_context.rb', line 15 def descriptors @descriptors end |
Class Method Details
.add_to_context(name, &func) ⇒ Object
10 11 12 |
# File 'middleman-core/lib/middleman-core/core_extensions/collections/step_context.rb', line 10 def add_to_context(name, &func) send(:define_method, :"_internal_#{name}", &func) end |
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
34 35 36 37 38 |
# File 'middleman-core/lib/middleman-core/core_extensions/collections/step_context.rb', line 34 def respond_to_missing?(method_name, include_private = false) return super if method_name.to_s.start_with?('_internal_') respond_to?(:"_internal_#{method_name}") || super end |