Class: Broadside::Configuration::ConfigStruct
- Inherits:
-
Object
- Object
- Broadside::Configuration::ConfigStruct
show all
- Defined in:
- lib/broadside/configuration/struct.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
19
20
21
|
# File 'lib/broadside/configuration/struct.rb', line 19
def method_missing(m, *args, &block)
warn "Unknown configuration '#{m}' provided, ignoring. Check your version of broadside?"
end
|
Instance Method Details
#to_h ⇒ Object
12
13
14
15
16
17
|
# File 'lib/broadside/configuration/struct.rb', line 12
def to_h
self.instance_variables.inject({}) do |h, var|
h[var] = self.instance_variable_get(var)
h
end
end
|
#verify(*args) ⇒ Object
4
5
6
7
8
9
10
|
# File 'lib/broadside/configuration/struct.rb', line 4
def verify(*args)
args.each do |var|
if self.send(var).nil?
raise Broadside::MissingVariableError, "Missing required #{self.class.to_s.split("::").last} variable '#{var}' !"
end
end
end
|