Module: FormattedString::Formats::Json

Defined in:
lib/formatted_string/formats/json.rb

Constant Summary collapse

JSON_OPTIONS =
{
  :include_key => true, # Can be true or false
  :key_name => 'id', # Default key name
}

Instance Method Summary collapse

Instance Method Details

#===(other) ⇒ Object



11
12
13
# File 'lib/formatted_string/formats/json.rb', line 11

def ===(other)
  to_hash == other.to_hash
end

#to_hash(options = {}) ⇒ Object



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

def to_hash(options={})
  JSON.parse(self)
end