Sha256: 105dc1174285360ed1ea7515bcef5f570c01f7bbc9ce30cd1d252d4ce9ca14bd

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

module OrigenTesters
  class IGXLBasedTester
    class Parser
      class DCSpecs < ::OrigenTesters::Parser::SearchableHash
        attr_accessor :parser

        def initialize(options = {})
          @parser = options[:parser]
        end

        def import(file)
          @categories = []
          File.readlines(file).each do |line|
            unless line.strip.empty?
              components = line.split("\t")
              if components[3] == 'Selector'
                extract_categories(components)
              else
                unless components[1] == 'DC Specs' || components[1] == 'Symbol'
                  extract_spec(components)
                end
              end
            end
          end
        end

        def inspect
          "<DCSpecs: #{size}>"
        end

        def extract_categories(components)
          components.each_with_index do |val, i|
            if i > 4
              @categories << val unless val.strip.empty?
            end
          end
          @categories.uniq!
        end

        def extract_spec(components)
          name = components[1]
          self[name] ||= DCSpec.new(name, @categories, parser: parser)
          self[name].add_values(components)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
origen_testers-0.13.2 lib/origen_testers/igxl_based_tester/parser/dc_specs.rb
origen_testers-0.10.0 lib/origen_testers/igxl_based_tester/parser/dc_specs.rb