Class: Sapphire::DSL::Browser::Matrix

Inherits:
Object
  • Object
show all
Defined in:
lib/sapphire/DSL/Browser/Verbs/Matrix.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Matrix

Returns a new instance of Matrix.



13
14
15
# File 'lib/sapphire/DSL/Browser/Verbs/Matrix.rb', line 13

def initialize(id)
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



11
12
13
# File 'lib/sapphire/DSL/Browser/Verbs/Matrix.rb', line 11

def id
  @id
end

Instance Method Details

#Create(matrix, &block) ⇒ Object



17
18
19
20
21
# File 'lib/sapphire/DSL/Browser/Verbs/Matrix.rb', line 17

def Create(matrix, &block)
  $matrix_variable = matrix.id
  block.call
  $matrix_variable = nil
end

#Using(matrix, &block) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/sapphire/DSL/Browser/Verbs/Matrix.rb', line 23

def Using(matrix, &block)
  raise "No matrix defined for: " + matrix.id if !$matrices.has_key? matrix.id

  $matrices[matrix.id].each do |array|
    array.each do |item|
      item.call()
    end
    block.call()
  end


end