Class: Parsed::ParsesJson
- Inherits:
-
Struct
- Object
- Struct
- Parsed::ParsesJson
- Defined in:
- lib/parsed/parses_json.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Class Method Summary collapse
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data
4 5 6 |
# File 'lib/parsed/parses_json.rb', line 4 def data @data end |
Class Method Details
.parse(data) ⇒ Object
6 7 8 9 10 |
# File 'lib/parsed/parses_json.rb', line 6 def self.parse(data) return data if data.instance_of? Hash JSON.parse(data, { :symbolize_names => true }) end |
.parse_elements(data, field) ⇒ Object
16 17 18 |
# File 'lib/parsed/parses_json.rb', line 16 def self.parse_elements(data, field) data[field.to_sym] || [] end |
.parse_value(data, field) ⇒ Object
12 13 14 |
# File 'lib/parsed/parses_json.rb', line 12 def self.parse_value(data, field) data[field.to_sym] end |