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, #assert_includes, #compare_includes?

Instance Method Details

#==(other) ⇒ Object



537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
# File 'lib/web/testing.rb', line 537

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



558
559
560
561
562
563
564
# File 'lib/web/testing.rb', line 558

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