Class: Genderize::Io::Parser::Json

Inherits:
Object
  • Object
show all
Defined in:
lib/genderize/io/parser/json.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#hashObject (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

#parseObject



23
24
25
# File 'lib/genderize/io/parser/json.rb', line 23

def parse
  @hash = JSON.parse(@data)
end