Module: Runbook::Extensions::Statements::DSL
- Defined in:
- lib/runbook/extensions/statements.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/runbook/extensions/statements.rb', line 4
def method_missing(name, *args, &block)
if (klass = Statements::DSL._statement_class(name))
klass.new(*args, &block).tap do |statement|
parent.add(statement)
if statement.respond_to?(:into)
Runbook.runtime_methods << statement.into
end
end
else
super
end
end
|
Class Method Details
._statement_class(name) ⇒ Object
22
23
24
25
|
# File 'lib/runbook/extensions/statements.rb', line 22
def self._statement_class(name)
"Runbook::Statements::#{name.to_s.camelize}".constantize
rescue NameError
end
|
Instance Method Details
#respond_to?(name, include_private = false) ⇒ Boolean
18
19
20
|
# File 'lib/runbook/extensions/statements.rb', line 18
def respond_to?(name, include_private = false)
!!(Statements::DSL._statement_class(name) || super)
end
|