Sha256: 118a05d7388605e1c8e3e07e03d30c8928020d56fff2d56dea46b4351d138739

Contents?: true

Size: 1.38 KB

Versions: 18

Compression:

Stored size: 1.38 KB

Contents

module Origen
  module Tester
    class Ultraflex
      module Generator
        class TestInstanceGroup
          attr_accessor :name, :version, :append_version

          include Enumerable

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

          def name
            if unversioned_name
              if version && @append_version
                "#{unversioned_name}_v#{version}"
              else
                unversioned_name.to_s
              end
            end
          end

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

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

          def size
            @store.size
          end

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

          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
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
origen-0.2.6 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.2.5 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.2.4 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.2.3 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.2.2 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.2.1 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.2.0 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.1.3 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.1.2 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.1.1 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.1.0 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.0.9 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.0.8 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.0.6 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.0.5 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.0.4 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.0.3 lib/origen/tester/ultraflex/generator/test_instance_group.rb
origen-0.0.2 lib/origen/tester/ultraflex/generator/test_instance_group.rb