Class: Origen::Tester::J750::Parser::DCSpecs

Inherits:
Parser::SearchableHash show all
Defined in:
lib/origen/tester/j750/parser/dc_specs.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Parser::SearchableHash

#where

Methods inherited from Hash

#filter, #ids, #intersect?, #intersections, #longest_key, #longest_value, #update_common

Constructor Details

- (DCSpecs) initialize(options = {})

Returns a new instance of DCSpecs



8
9
10
# File 'lib/origen/tester/j750/parser/dc_specs.rb', line 8

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

Instance Attribute Details

- (Object) parser

Returns the value of attribute parser



6
7
8
# File 'lib/origen/tester/j750/parser/dc_specs.rb', line 6

def parser
  @parser
end

Instance Method Details

- (Object) extract_categories(components)



32
33
34
35
36
37
38
39
# File 'lib/origen/tester/j750/parser/dc_specs.rb', line 32

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

- (Object) extract_spec(components)



41
42
43
44
45
# File 'lib/origen/tester/j750/parser/dc_specs.rb', line 41

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

- (Object) import(file)



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/origen/tester/j750/parser/dc_specs.rb', line 12

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

- (Object) inspect



28
29
30
# File 'lib/origen/tester/j750/parser/dc_specs.rb', line 28

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