Module: Configurator::DSL::InstanceMethods
- Defined in:
- lib/configurator/dsl.rb
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, &block) ⇒ Object
74
75
76
77
78
79
80
81
82
|
# File 'lib/configurator/dsl.rb', line 74
def method_missing(method, *args, &block)
if config.include? method
config[method]
elsif config.public_methods.include? method
config.public_send(method, *args, &block)
else
super
end
end
|
Instance Attribute Details
#config_path ⇒ Object
Returns the value of attribute config_path.
62
63
64
|
# File 'lib/configurator/dsl.rb', line 62
def config_path
@config_path
end
|
Instance Method Details
#alias!(orig_path, new_path) ⇒ Object
107
108
109
|
# File 'lib/configurator/dsl.rb', line 107
def alias!(orig_path, new_path)
config.alias!(orig_path, new_path)
end
|
#config ⇒ Object
Also known as:
root
64
65
66
|
# File 'lib/configurator/dsl.rb', line 64
def config
@config ||= self.class.config
end
|
#deprecate!(path, end_of_life = nil) ⇒ Object
111
112
113
|
# File 'lib/configurator/dsl.rb', line 111
def deprecate!(path, end_of_life = nil)
config.deprecate!(path, end_of_life)
end
|
#load(config_path, env) ⇒ Object
95
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/configurator/dsl.rb', line 95
def load(config_path, env)
self.tap {
@env = env
@config_path = config_path
config.load loader.load(@env)
unless config.requirements_fullfilled?
raise ConfigurationInvalid, "Missing one or more required options."
end
}
end
|
#load_from_hash(hash) ⇒ Object
119
120
121
|
# File 'lib/configurator/dsl.rb', line 119
def load_from_hash(hash)
config.load hash
end
|
#reload! ⇒ Object
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/configurator/dsl.rb', line 84
def reload!
return false unless config_path
return false unless @env
config.load loader.reload!(@env)
unless config.requirements_fullfilled?
raise ConfigurationInvalid, "Missing one or more required options."
end
self
end
|
#rename!(old_path, target_path) ⇒ Object
115
116
117
|
# File 'lib/configurator/dsl.rb', line 115
def rename!(old_path, target_path)
config.rename!(old_path, target_path)
end
|
#respond_to?(method) ⇒ Boolean
69
70
71
72
|
# File 'lib/configurator/dsl.rb', line 69
def respond_to?(method)
return true if config.respond_to? method
super
end
|
#to_h ⇒ Object
128
129
130
|
# File 'lib/configurator/dsl.rb', line 128
def to_h
@config.to_h
end
|
#to_yaml ⇒ Object
132
133
134
|
# File 'lib/configurator/dsl.rb', line 132
def to_yaml
@config.to_yaml
end
|