Module: Hato::Config::DSL
Instance Attribute Summary collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/hato/config.rb', line 14
def method_missing(method, *args)
if args.empty?
config.send(method)
else
config[method] = args.first
end
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
7
8
9
|
# File 'lib/hato/config.rb', line 7
def name
@name
end
|
Instance Method Details
#activate!(args = nil) ⇒ Object
22
23
24
25
26
27
28
29
|
# File 'lib/hato/config.rb', line 22
def activate!(args = nil)
if !args || args.empty?
instance_eval(&@block)
else
instance_exec(*args, &@block)
end
self
end
|
#initialize(name, &block) ⇒ Object
9
10
11
12
|
# File 'lib/hato/config.rb', line 9
def initialize(name, &block)
@name = name
@block = block
end
|