Class: Relevance::Tarantula::Attack
- Defined in:
- lib/relevance/tarantula/attack.rb
Constant Summary collapse
- HASHABLE_ATTRS =
[:name, :input, :output, :description]
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(hash) ⇒ Attack
constructor
A new instance of Attack.
Constructor Details
#initialize(hash) ⇒ Attack
Returns a new instance of Attack.
4 5 6 7 8 9 |
# File 'lib/relevance/tarantula/attack.rb', line 4 def initialize(hash) hash.each do |k,v| raise ArgumentError, k unless HASHABLE_ATTRS.member?(k) self.instance_variable_set("@#{k}", v) end end |
Instance Method Details
#==(other) ⇒ Object
10 11 12 |
# File 'lib/relevance/tarantula/attack.rb', line 10 def ==(other) Relevance::Tarantula::Attack === other && HASHABLE_ATTRS.all? { |attr| send(attr) == other.send(attr)} end |