Class: OrigenTesters::IGXLBasedTester::Parser::PatternSet::Pattern

Inherits:
Object
  • Object
show all
Defined in:
lib/origen_testers/igxl_based_tester/parser/pattern_set.rb

Constant Summary collapse

ATTRS =
%w(pattern_set file_name start_label stop_label comment)
ALIASES =
{
  pattern: :file_name,
  file:    :file_name,
  name:    :file_name
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ Pattern

Returns a new instance of Pattern.


27
28
29
30
31
32
33
34
35
# File 'lib/origen_testers/igxl_based_tester/parser/pattern_set.rb', line 27

def initialize(line)
  @line = line
  parse
  if valid?
    ATTRS.each_with_index do |attr, i|
      instance_variable_set("@#{attr}", components[i + 1])
    end
  end
end

Instance Attribute Details

#parserObject

Returns the value of attribute parser.


6
7
8
# File 'lib/origen_testers/igxl_based_tester/parser/pattern_set.rb', line 6

def parser
  @parser
end

Instance Method Details

#componentsObject


46
47
48
# File 'lib/origen_testers/igxl_based_tester/parser/pattern_set.rb', line 46

def components
  @components ||= []
end

#parseObject


37
38
39
# File 'lib/origen_testers/igxl_based_tester/parser/pattern_set.rb', line 37

def parse
  @components = @line.split("\t") unless @line.strip.empty?
end

#valid?Boolean

Returns:

  • (Boolean)

41
42
43
44
# File 'lib/origen_testers/igxl_based_tester/parser/pattern_set.rb', line 41

def valid?
  components[1] && !components[1].empty? && components[1] != 'Pattern Set' &&
    components[2] && !components[2].empty?
end