Class: Calais::Response::CalaisHash

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#valueObject

Returns the value of attribute value.



64
65
66
# File 'lib/calais/response.rb', line 64

def value
  @value
end

Class Method Details

.find_or_create(hash, hashes) ⇒ Object



66
67
68
69
70
71
72
73
74
# File 'lib/calais/response.rb', line 66

def self.find_or_create(hash, hashes)
  if !selected = hashes.select {|h| h.value == hash }.first
    selected = self.new
    selected.value = hash
    hashes << selected
  end

  selected
end