Class: OrigenTesters::IGXLBasedTester::Base::Patsubrs

Inherits:
Object
  • Object
show all
Includes:
Generator
Defined in:
lib/origen_testers/igxl_based_tester/base/patsubrs.rb

Direct Known Subclasses

J750::Patsubrs, UltraFLEX::Patsubrs

Constant Summary collapse

OUTPUT_POSTFIX =
'patsubrs'

Instance Method Summary collapse

Methods included from Generator

#close, #collection, #collection=, #compiler, #current_dir, #dont_diff=, execute_source, #file_extension, #file_pipeline, #filename, #filename=, #identity_map, #import, #inhibit_output, #name, #on_close, original_reference_file, original_reference_file=, #output_file, #output_inhibited?, #platform, #reference_file, #render, #set_flow_description, #stats, #to_be_written?, #write_from_template, #write_to_file

Instance Method Details

#add(name, options = {}) ⇒ Object


9
10
11
12
13
# File 'lib/origen_testers/igxl_based_tester/base/patsubrs.rb', line 9

def add(name, options = {})
  p = Patsubr.new(name, options)
  collection << p
  p
end

#finalize(options = {}) ⇒ Object


15
16
17
18
# File 'lib/origen_testers/igxl_based_tester/base/patsubrs.rb', line 15

def finalize(options = {})
  uniq!
  sort!
end

#sort!Object

Present the patsubrs in the final sheet in alphabetical order


21
22
23
# File 'lib/origen_testers/igxl_based_tester/base/patsubrs.rb', line 21

def sort!
  collection.sort_by!(&:name)
end

#uniq!Object

Removes all duplicate patsubrs


26
27
28
29
30
31
32
33
34
# File 'lib/origen_testers/igxl_based_tester/base/patsubrs.rb', line 26

def uniq!
  uniques = []
  collection.each do |patsubr|
    unless uniques.any? { |p| p == patsubr }
      uniques << patsubr
    end
  end
  self.collection = uniques
end