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
|
# 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)
end
else
super
end
end
|
Class Method Details
._statement_class(name) ⇒ Object
18
19
20
21
|
# File 'lib/runbook/extensions/statements.rb', line 18
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
14
15
16
|
# File 'lib/runbook/extensions/statements.rb', line 14
def respond_to?(name, include_private = false)
!!(Statements::DSL._statement_class(name) || super)
end
|