Class: Genderize::Io::Parser::Json
- Inherits:
-
Object
- Object
- Genderize::Io::Parser::Json
- Defined in:
- lib/genderize/io/parser/json.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ Json
constructor
A new instance of Json.
- #parse ⇒ Object
Constructor Details
#initialize(data) ⇒ Json
Returns a new instance of Json.
12 13 14 15 |
# File 'lib/genderize/io/parser/json.rb', line 12 def initialize(data) @data = data @hash = {} end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
10 11 12 |
# File 'lib/genderize/io/parser/json.rb', line 10 def hash @hash end |
Class Method Details
.parse(data) ⇒ Object
17 18 19 20 21 |
# File 'lib/genderize/io/parser/json.rb', line 17 def self.parse(data) instance = new(data) instance.parse instance.hash end |
Instance Method Details
#parse ⇒ Object
23 24 25 |
# File 'lib/genderize/io/parser/json.rb', line 23 def parse @hash = JSON.parse(@data) end |