Class: Middleman::CoreExtensions::Collections::StepContext
- Inherits:
-
Object
- Object
- Middleman::CoreExtensions::Collections::StepContext
- Defined in:
- 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
Constructor Details
#initialize(app) ⇒ StepContext
Returns a new instance of StepContext.
15 16 17 18 |
# File 'lib/middleman-core/core_extensions/collections/step_context.rb', line 15 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
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/middleman-core/core_extensions/collections/step_context.rb', line 20 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.
6 7 8 |
# File 'lib/middleman-core/core_extensions/collections/step_context.rb', line 6 def current @current end |
Instance Attribute Details
#descriptors ⇒ Object (readonly)
Returns the value of attribute descriptors.
13 14 15 |
# File 'lib/middleman-core/core_extensions/collections/step_context.rb', line 13 def descriptors @descriptors end |
Class Method Details
.add_to_context(name, &func) ⇒ Object
8 9 10 |
# File 'lib/middleman-core/core_extensions/collections/step_context.rb', line 8 def add_to_context(name, &func) send(:define_method, :"_internal_#{name}", &func) end |