Class: ConfId
- Inherits:
-
Object
show all
- Defined in:
- lib/vimamsa/conf.rb
Instance Method Summary
collapse
Constructor Details
#initialize(first) ⇒ ConfId
Returns a new instance of ConfId.
36
37
38
|
# File 'lib/vimamsa/conf.rb', line 36
def initialize(first)
@id = [first]
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/vimamsa/conf.rb', line 40
def method_missing(method_name, *args)
if m = method_name.match(/(.*)=$/)
@id << m[1].to_sym
set(self, args[0])
return args[0]
elsif m = method_name.match(/(.*)[\!\?]$/)
@id << m[1].to_sym
r = get(self)
if r.class == Hash and r.empty?
return nil
else
return r
end
else
@id << method_name
end
return self
end
|
Instance Method Details
#to_a ⇒ Object
68
69
70
|
# File 'lib/vimamsa/conf.rb', line 68
def to_a
return @id
end
|
#to_s ⇒ Object
64
65
66
|
# File 'lib/vimamsa/conf.rb', line 64
def to_s
@id.join(".")
end
|