Module: Hashify::Json

Defined in:
lib/hashify/json.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(cls) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/hashify/json.rb', line 5

def self.included(cls)
  cls.instance_eval("include Hashify") unless cls.include?(Hashify)

  cls.instance_eval "
  def self.from_json(json)
    from_hash(JSON.parse(json))
  end
  "
end

Instance Method Details

#to_jsonObject



15
16
17
# File 'lib/hashify/json.rb', line 15

def to_json
  to_hash.to_json
end