Class: Telerivet::CustomVars

Inherits:
Object
  • Object
show all
Defined in:
lib/telerivet/entity.rb

Instance Method Summary collapse

Constructor Details

#initialize(vars) ⇒ CustomVars

Returns a new instance of CustomVars.



86
87
88
89
# File 'lib/telerivet/entity.rb', line 86

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



112
113
114
115
116
117
118
119
# File 'lib/telerivet/entity.rb', line 112

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

#allObject



91
92
93
# File 'lib/telerivet/entity.rb', line 91

def all()
    @vars
end

#clear_dirty_variablesObject



99
100
101
# File 'lib/telerivet/entity.rb', line 99

def clear_dirty_variables()
    @dirty = {}
end

#get(name) ⇒ Object



103
104
105
# File 'lib/telerivet/entity.rb', line 103

def get(name)
    @vars[name]
end

#get_dirty_variablesObject



95
96
97
# File 'lib/telerivet/entity.rb', line 95

def get_dirty_variables()
    @dirty
end

#set(name, value) ⇒ Object



107
108
109
110
# File 'lib/telerivet/entity.rb', line 107

def set(name, value)
    @vars[name] = value
    @dirty[name] = value
end