Class: OrigenTesters::IGXLBasedTester::Base::TestInstanceGroup

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/origen_testers/igxl_based_tester/base/test_instance_group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ TestInstanceGroup

Returns a new instance of TestInstanceGroup.



9
10
11
12
13
# File 'lib/origen_testers/igxl_based_tester/base/test_instance_group.rb', line 9

def initialize(name, options = {})
  @name = name
  @store = []
  @append_version = true
end

Instance Attribute Details

#append_versionObject

Returns the value of attribute append_version.



5
6
7
# File 'lib/origen_testers/igxl_based_tester/base/test_instance_group.rb', line 5

def append_version
  @append_version
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/origen_testers/igxl_based_tester/base/test_instance_group.rb', line 5

def name
  @name
end

#versionObject

Returns the value of attribute version.



5
6
7
# File 'lib/origen_testers/igxl_based_tester/base/test_instance_group.rb', line 5

def version
  @version
end

Instance Method Details

#<<(instance) ⇒ Object



35
36
37
# File 'lib/origen_testers/igxl_based_tester/base/test_instance_group.rb', line 35

def <<(instance)
  @store << instance
end

#==(other_instance_group) ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/origen_testers/igxl_based_tester/base/test_instance_group.rb', line 47

def ==(other_instance_group)
  self.class == other_instance_group.class &&
    unversioned_name.to_s == other_instance_group.unversioned_name.to_s &&
    size == other_instance_group.size &&
    self.all? do |ins|
      other_instance_group.any? { |other_ins| ins == other_ins }
    end
end

#eachObject



43
44
45
# File 'lib/origen_testers/igxl_based_tester/base/test_instance_group.rb', line 43

def each
  @store.each { |ins| yield ins }
end

#finalizeObject



56
57
58
59
60
61
62
# File 'lib/origen_testers/igxl_based_tester/base/test_instance_group.rb', line 56

def finalize
  lambda do |group|
    each do |ti|
      ti.finalize.call(ti) if ti.finalize
    end
  end
end

#sizeObject



39
40
41
# File 'lib/origen_testers/igxl_based_tester/base/test_instance_group.rb', line 39

def size
  @store.size
end

#unversioned_nameObject



25
26
27
28
29
30
31
32
33
# File 'lib/origen_testers/igxl_based_tester/base/test_instance_group.rb', line 25

def unversioned_name
  if @name
    if @name =~ /grp$/
      @name
    else
      "#{@name}_grp"
    end
  end
end