Class: OrigenTesters::IGXLBasedTester::Base::Patsubr
- Inherits:
-
Object
- Object
- OrigenTesters::IGXLBasedTester::Base::Patsubr
- Defined in:
- lib/origen_testers/igxl_based_tester/base/patsubr.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
Instance Method Summary collapse
- #==(other_patset) ⇒ Object
-
#initialize(name, attrs = {}) ⇒ Patsubr
constructor
Specify multiple patterns by passing an array of attributes as the 2nd argument:.
-
#lines ⇒ Object
Returns all lines in the pattern set.
- #name ⇒ Object
- #name=(n) ⇒ Object
- #platform ⇒ Object
-
#sorted_pattern_files ⇒ Object
Returns all pattern files in the pattern set in alphabetical order.
-
#to_s ⇒ Object
Returns the fully formatted pattern set for insertion into a patset sheet.
Constructor Details
#initialize(name, attrs = {}) ⇒ Patsubr
Specify multiple patterns by passing an array of attributes as the 2nd argument:
Patset.new("mrd1_pset", :pattern => "nvm_mrd1.PAT")
Patset.new("mrd1_pset", [{:pattern => "nvm_mrd1.PAT"},
{:pattern => "nvm_global_subs.PAT, :start_label => "subr"}
])
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/origen_testers/igxl_based_tester/base/patsubr.rb', line 15 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 << platform::PatsubrPattern.new(name, pattrs) end self.name = name end |
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
5 6 7 |
# File 'lib/origen_testers/igxl_based_tester/base/patsubr.rb', line 5 def index @index end |
Instance Method Details
#==(other_patset) ⇒ Object
27 28 29 30 31 |
# File 'lib/origen_testers/igxl_based_tester/base/patsubr.rb', line 27 def ==(other_patset) self.class == other_patset.class && name.to_s == other_patset.name.to_s && sorted_pattern_files == other_patset.sorted_pattern_files end |
#lines ⇒ Object
Returns all lines in the pattern set
44 45 46 |
# File 'lib/origen_testers/igxl_based_tester/base/patsubr.rb', line 44 def lines @lines ||= [] end |
#name ⇒ Object
33 34 35 |
# File 'lib/origen_testers/igxl_based_tester/base/patsubr.rb', line 33 def name @name end |
#name=(n) ⇒ Object
37 38 39 40 41 |
# File 'lib/origen_testers/igxl_based_tester/base/patsubr.rb', line 37 def name=(n) @name = n lines.each { |l| l.pattern_set = n } n end |
#platform ⇒ Object
62 63 64 |
# File 'lib/origen_testers/igxl_based_tester/base/patsubr.rb', line 62 def platform Origen.interface.platform end |
#sorted_pattern_files ⇒ Object
Returns all pattern files in the pattern set in alphabetical order
49 50 51 |
# File 'lib/origen_testers/igxl_based_tester/base/patsubr.rb', line 49 def sorted_pattern_files @lines.map(&:file_name).sort end |
#to_s ⇒ Object
Returns the fully formatted pattern set for insertion into a patset sheet
54 55 56 57 58 59 60 |
# File 'lib/origen_testers/igxl_based_tester/base/patsubr.rb', line 54 def to_s l = '' lines.each do |line| l += "#{line}\r\n" end l.chomp end |