Class: Hash
Instance Method Summary collapse
- #AltText(item, comparator) ⇒ Object
- #Contain(item, comparator) ⇒ Object
- #Count(item, comparator) ⇒ Object
- #Examine(item, comparator, &block) ⇒ Object
- #Fix(evaluation, comparator) ⇒ Object
- #For(item) ⇒ Object
- #GetKey(item, &block) ⇒ Object
- #In(item, comparator) ⇒ Object
- #Set(hash) ⇒ Object
- #Show(item, comparator) ⇒ Object
- #Source(item, comparator) ⇒ Object
- #Using(items) ⇒ Object
- #Validate(hash, comparator) ⇒ Object
Instance Method Details
#AltText(item, comparator) ⇒ Object
56 57 58 59 60 |
# File 'lib/sapphire/Extensions/Hash.rb', line 56 def AltText(item, comparator) Examine(item, comparator) do |field, value| field.AltText(value, comparator) end end |
#Contain(item, comparator) ⇒ Object
68 69 70 71 72 |
# File 'lib/sapphire/Extensions/Hash.rb', line 68 def Contain(item, comparator) Examine(item, comparator) do |field, value| field.Contain(value) end end |
#Count(item, comparator) ⇒ Object
74 75 76 77 78 |
# File 'lib/sapphire/Extensions/Hash.rb', line 74 def Count(item, comparator) Examine(item, comparator) do |field, value| field.Count(value) end end |
#Examine(item, comparator, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/sapphire/Extensions/Hash.rb', line 11 def Examine(item, comparator, &block) flip = false key = GetKey(item) do |item| item.keys.first end return FieldNotDefinedEvaluation.new(key, $page) if !$page.Contains key and !Parameters.instance.Contains key field = $page.Get(key) if $page.Contains key if(field.nil?) key1 = GetKey(item) do |item| item[item.keys.first] end if $page.Contains key1 field = $page.Get(key1) flip = true end end return Fix(Evaluation.new(Parameter(key), item.first[key]), comparator) if Parameters.instance.Contains(key) and field.nil? return FieldNotFoundEvaluation.new(key, $page, "selenium could not find the field") if field == nil evaluation = field.Evaluate(key, item, comparator, block) if(flip) left = evaluation.left right = evaluation.right evaluation.right = left evaluation.left = right end return Fix(evaluation, comparator) end |
#Fix(evaluation, comparator) ⇒ Object
91 92 93 94 |
# File 'lib/sapphire/Extensions/Hash.rb', line 91 def Fix(evaluation, comparator) comparator = comparator.Create(evaluation) comparator end |
#For(item) ⇒ Object
7 8 9 |
# File 'lib/sapphire/Extensions/Hash.rb', line 7 def For(item) {item => GetPageField(item).Text} end |
#GetKey(item, &block) ⇒ Object
45 46 47 48 |
# File 'lib/sapphire/Extensions/Hash.rb', line 45 def GetKey(item, &block) return block.call(item.first) if item.first.is_a? Hash return item.first.first if item.first.is_a? Array end |
#In(item, comparator) ⇒ Object
80 81 82 83 84 |
# File 'lib/sapphire/Extensions/Hash.rb', line 80 def In(item, comparator) Examine(item, comparator) do |field, value| field.In(value, comparator) end end |
#Set(hash) ⇒ Object
3 4 5 |
# File 'lib/sapphire/Extensions/Hash.rb', line 3 def Set(hash) hash.keys.first.Set(hash) end |
#Show(item, comparator) ⇒ Object
50 51 52 53 54 |
# File 'lib/sapphire/Extensions/Hash.rb', line 50 def Show(item, comparator) Examine(item, comparator) do |field, value| field.Equals(value, comparator) end end |
#Source(item, comparator) ⇒ Object
62 63 64 65 66 |
# File 'lib/sapphire/Extensions/Hash.rb', line 62 def Source(item, comparator) Examine(item, comparator) do |field, value| field.Source(value, comparator) end end |
#Using(items) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/sapphire/Extensions/Hash.rb', line 96 def Using(items) $matrices ||= {} master_array = [] master_array = $matrices[$matrix_variable] if $matrices.has_key? $matrix_variable array = [] items.keys.each do |key| array << Proc.new { Parameter key => items[key] } end master_array << array $matrices.merge! $matrix_variable => master_array end |