Class: Score

Inherits:
Object
  • Object
show all
Defined in:
lib/gorse.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, score) ⇒ Score

Returns a new instance of Score.



41
42
43
44
# File 'lib/gorse.rb', line 41

def initialize(id, score)
  @id = id
  @score = score
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



51
52
53
# File 'lib/gorse.rb', line 51

def id
  @id
end

#scoreObject (readonly)

Returns the value of attribute score.



51
52
53
# File 'lib/gorse.rb', line 51

def score
  @score
end

Class Method Details

.from_json(string) ⇒ Object



46
47
48
49
# File 'lib/gorse.rb', line 46

def self.from_json(string)
  data = JSON.load string
  data.map { |h| Score.new(h['Id'], h['Score']) }
end