Class: Asetus::ConfigStruct
- Inherits:
-
Object
- Object
- Asetus::ConfigStruct
show all
- Defined in:
- lib/asetus/configstruct.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'lib/asetus/configstruct.rb', line 25
def method_missing name, *args, &block
name = name.to_s
arg = args.first
if name[-1..-1] == '='
_asetus_set name[0..-2], arg
else
_asetus_get name, arg
end
end
|
Instance Method Details
#_asetus_to_hash ⇒ Object
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/asetus/configstruct.rb', line 4
def _asetus_to_hash
hash = {}
@cfg.each do |key, value|
if value.class == ConfigStruct
value = value._asetus_to_hash
end
hash[key] = value
end
hash
end
|
#empty? ⇒ Boolean
15
16
17
|
# File 'lib/asetus/configstruct.rb', line 15
def empty?
@cfg.empty?
end
|