Class: Origen::Tester::J750::Parser::PatternSets

Inherits:
Parser::SearchableHash show all
Defined in:
lib/origen/tester/j750/parser/pattern_sets.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

- (PatternSets) initialize(options = {})

Returns a new instance of PatternSets



8
9
10
# File 'lib/origen/tester/j750/parser/pattern_sets.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/pattern_sets.rb', line 6

def parser
  @parser
end

Instance Method Details

- (Object) import(file)



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

def import(file)
  File.readlines(file).each do |line|
    name = PatternSet.extract_name(line)
    if name
      if self[name]
        self[name].add_pattern_line(line)
      else
        l = PatternSet.new(line, parser: parser)
        self[l.name] = l if l.valid?
      end
    end
  end
end

- (Object) inspect



26
27
28
# File 'lib/origen/tester/j750/parser/pattern_sets.rb', line 26

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