Class: WEEL::ReadHash
Overview
}}}
Instance Method Summary collapse
-
#initialize(values, sim = false) ⇒ ReadHash
constructor
{{{.
- #method_missing(name, *args) ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(values, sim = false) ⇒ ReadHash
{{{
190 191 192 193 |
# File 'lib/weel.rb', line 190 def initialize(values,sim=false) @__weel_values = values @__weel_sim = sim end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/weel.rb', line 199 def method_missing(name,*args) if args.empty? && @__weel_values.key?(name) if @__weel_sim "➤#{name}" else @__weel_values[name] end #TODO dont let user change stuff e.g. if return value is an array (deep clone and/or deep freeze it?) else nil end end |
Instance Method Details
#to_json(*args) ⇒ Object
195 196 197 |
# File 'lib/weel.rb', line 195 def to_json(*args) @__weel_values.to_json(*args) end |