Class: Contactology::Issues

Inherits:
Array
  • Object
show all
Defined in:
lib/contactology/issues.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Array

#extract_options!

Constructor Details

#initialize(data = nil) ⇒ Issues

Returns a new instance of Issues.



9
10
11
12
13
# File 'lib/contactology/issues.rb', line 9

def initialize(data = nil)
  data = Hash.new unless data.is_a?(Hash)
  @score = data['score'] || 0
  (data['issues'] || []).each { |i| self << i }
end

Instance Attribute Details

#scoreObject (readonly)

Returns the value of attribute score.



7
8
9
# File 'lib/contactology/issues.rb', line 7

def score
  @score
end

Instance Method Details

#<<(o) ⇒ Object



16
17
18
# File 'lib/contactology/issues.rb', line 16

def <<(o)
  super(Issue.new(o))
end