Sha256: f434bb63a126764b6cd0cd1fa32dcfa629ae231a09dd30939a9b69ee438dbcfe

Contents?: true

Size: 1.39 KB

Versions: 8

Compression:

Stored size: 1.39 KB

Contents

module OrigenTesters
  class Doc
    module Generator
      class TestGroup
        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 to_yaml(options = {})
          y = {}
          y['group'] = @store.map { |t| t.to_yaml(options) }
          y
        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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
origen_testers-0.5.7 lib/origen_testers/doc/generator/test_group.rb
origen_testers-0.5.6 lib/origen_testers/doc/generator/test_group.rb
origen_testers-0.5.5 lib/origen_testers/doc/generator/test_group.rb
origen_testers-0.5.4 lib/origen_testers/doc/generator/test_group.rb
origen_testers-0.5.3 lib/origen_testers/doc/generator/test_group.rb
origen_testers-0.5.2 lib/origen_testers/doc/generator/test_group.rb
origen_testers-0.5.1 lib/origen_testers/doc/generator/test_group.rb
origen_testers-0.5.0 lib/origen_testers/doc/generator/test_group.rb