Class: OrigenTesters::IGXLBasedTester::Base::PatsubrPattern

Inherits:
Object
  • Object
show all
Defined in:
lib/origen_testers/igxl_based_tester/base/patsubr_pattern.rb

Constant Summary collapse

ALIASES =
{
  pattern: :file_name
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(patsubr, attrs = {}) ⇒ PatsubrPattern

Returns a new instance of PatsubrPattern.



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/origen_testers/igxl_based_tester/base/patsubr_pattern.rb', line 34

def initialize(patsubr, attrs = {})
  # Set the defaults
  self.class::PATSUBR_DEFAULTS.each do |k, v|
    send("#{k}=", v)
  end
  # Then the values that have been supplied
  self.pattern_subr = patsubr
  attrs.each do |k, v|
    send("#{k}=", v)
  end
end

Class Method Details

.defineObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/origen_testers/igxl_based_tester/base/patsubr_pattern.rb', line 9

def self.define
  # Generate accessors for all attributes and their aliases
  self::PATSUBR_ATTRS.each do |attr|
    writer = "#{attr}=".to_sym
    reader = attr.to_sym
    attr_reader attr.to_sym unless method_defined? reader
    attr_writer attr.to_sym unless method_defined? writer
  end

  ALIASES.each do |_alias, val|
    writer = "#{_alias}=".to_sym
    reader = _alias.to_sym
    unless method_defined? writer
      define_method("#{_alias}=") do |v|
        send("#{val}=", v)
      end
    end
    unless method_defined? reader
      define_method("#{_alias}") do
        send(val)
      end
    end
  end
end

Instance Method Details

#to_sObject



46
47
48
49
50
51
52
# File 'lib/origen_testers/igxl_based_tester/base/patsubr_pattern.rb', line 46

def to_s
  l = "\t"
  self.class::PATSUBR_ATTRS.each do |attr|
    l += "#{send(attr)}\t"
  end
  "#{l}"
end