Class: Web::Testing::SelectHash

Inherits:
Hash show all
Defined in:
lib/web/testing.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from Hash

#__index, #compare_includes?

Instance Method Details

#==(other) ⇒ Object



417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/web/testing.rb', line 417

def == other
  if (other.kind_of? Hash)
    super(other)
  elsif (other.class == TrueClass)
    result = true
    self.each{ |k, v|
      result = false unless v
    }
    result
  elsif (other.class == FalseClass)
    result = true
    self.each{ |k,v|
      result = false if v
    }
    result
  else
    ### this is wrong
    other.to_s == self.default.join(",")
  end
end

#field_valueObject



438
439
440
441
442
443
444
# File 'lib/web/testing.rb', line 438

def field_value
  values = [ ]
  self.each{ |k,v|
    values.push k if v
  }
  values.join(",")
end