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.



69
70
71
# File 'lib/calais/response.rb', line 69

def value
  @value
end

Class Method Details

.find_or_create(hash, hashes) ⇒ Object



71
72
73
74
75
76
77
78
79
# File 'lib/calais/response.rb', line 71

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