Class: Telerivet::CustomVars
- Inherits:
-
Object
- Object
- Telerivet::CustomVars
show all
- Defined in:
- lib/telerivet/entity.rb
Instance Method Summary
collapse
Constructor Details
88
89
90
91
|
# File 'lib/telerivet/entity.rb', line 88
def initialize(vars)
@vars = vars
@dirty = {}
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ Object
114
115
116
117
118
119
120
121
|
# File 'lib/telerivet/entity.rb', line 114
def method_missing(m, *args)
name = m.to_s
if name.end_with?('=')
set(name.chop, args[0])
else
get(name)
end
end
|
Instance Method Details
#all ⇒ Object
93
94
95
|
# File 'lib/telerivet/entity.rb', line 93
def all()
@vars
end
|
#clear_dirty_variables ⇒ Object
101
102
103
|
# File 'lib/telerivet/entity.rb', line 101
def clear_dirty_variables()
@dirty = {}
end
|
#get(name) ⇒ Object
105
106
107
|
# File 'lib/telerivet/entity.rb', line 105
def get(name)
@vars[name]
end
|
#get_dirty_variables ⇒ Object
97
98
99
|
# File 'lib/telerivet/entity.rb', line 97
def get_dirty_variables()
@dirty
end
|
#set(name, value) ⇒ Object
109
110
111
112
|
# File 'lib/telerivet/entity.rb', line 109
def set(name, value)
@vars[name] = value
@dirty[name] = value
end
|