Class: Origen::Tester::J750::Generator::Patgroup

Inherits:
Object
  • Object
show all
Defined in:
lib/origen/tester/j750/generator/patgroup.rb

Defined Under Namespace

Classes: Pattern

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Patgroup) initialize(name, attrs = {})

Specify multiple patterns by passing an array of attributes as the 2nd argument:

Patset.new("mrd1_pgrp", :pattern => "nvm_mrd1.PAT")

Patset.new("mrd1_pgrp", [{:pattern => "nvm_mrd1.PAT"},
                         {:pattern => "nvm_global_subs.PAT},
                        ])


61
62
63
64
65
66
67
68
69
70
71
# File 'lib/origen/tester/j750/generator/patgroup.rb', line 61

def initialize(name, attrs = {})
  attrs = [attrs] unless attrs.is_a? Array
  attrs.each do |pattrs|
    if pattrs[:pattern]
      pat = Pathname.new(pattrs[:pattern].gsub('\\', '/')).basename('.*').to_s
      Origen.interface.referenced_patterns << pat
    end
    lines << Pattern.new(name, pattrs)
  end
  self.name = name
end

Instance Attribute Details

- (Object) index

Returns the value of attribute index



6
7
8
# File 'lib/origen/tester/j750/generator/patgroup.rb', line 6

def index
  @index
end

Instance Method Details

- (Object) ==(other_patgroup)



73
74
75
76
77
# File 'lib/origen/tester/j750/generator/patgroup.rb', line 73

def ==(other_patgroup)
  self.class == other_patgroup.class &&
    name.to_s == other_patgroup.name.to_s &&
    sorted_pattern_files == other_patgroup.sorted_pattern_files
end

- (Object) lines

Returns all lines in the pattern set



90
91
92
# File 'lib/origen/tester/j750/generator/patgroup.rb', line 90

def lines
  @lines ||= []
end

- (Object) name



79
80
81
# File 'lib/origen/tester/j750/generator/patgroup.rb', line 79

def name
  @name
end

- (Object) name=(n)



83
84
85
86
87
# File 'lib/origen/tester/j750/generator/patgroup.rb', line 83

def name=(n)
  @name = n
  lines.each { |l| l.group_name = n }
  n
end

- (Object) sorted_pattern_files

Returns all pattern files in the pattern set in alphabetical order



95
96
97
# File 'lib/origen/tester/j750/generator/patgroup.rb', line 95

def sorted_pattern_files
  @lines.map(&:file_name).sort
end

- (Object) to_s

Returns the fully formatted pattern group for insertion into a patgroups sheet



100
101
102
103
104
105
106
# File 'lib/origen/tester/j750/generator/patgroup.rb', line 100

def to_s
  l = ''
  lines.each do |line|
    l += "#{line}\r\n"
  end
  l.chomp
end