Method: JSONx#initialize
- Defined in:
- lib/jsonx.rb
#initialize(obj) ⇒ JSONx
Returns a new instance of JSONx.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jsonx.rb', line 13 def initialize(obj) if obj.is_a?(String) then if obj.lstrip[0] == '<' then jsonx_to_json obj else json_to_jsonx JSON.parse(obj) end else json_to_jsonx obj # transform the hash end end |