Class: Origen::Tester::Ultraflex::Parser::PatternSet::Pattern
- Defined in:
- lib/origen/tester/ultraflex/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
-
#parser ⇒ Object
Returns the value of attribute parser.
Instance Method Summary collapse
- #components ⇒ Object
-
#initialize(line) ⇒ Pattern
constructor
A new instance of Pattern.
- #parse ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(line) ⇒ Pattern
Returns a new instance of Pattern.
28 29 30 31 32 33 34 35 36 |
# File 'lib/origen/tester/ultraflex/parser/pattern_set.rb', line 28 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
#parser ⇒ Object
Returns the value of attribute parser.
7 8 9 |
# File 'lib/origen/tester/ultraflex/parser/pattern_set.rb', line 7 def parser @parser end |
Instance Method Details
#components ⇒ Object
47 48 49 |
# File 'lib/origen/tester/ultraflex/parser/pattern_set.rb', line 47 def components @components ||= [] end |
#parse ⇒ Object
38 39 40 |
# File 'lib/origen/tester/ultraflex/parser/pattern_set.rb', line 38 def parse @components = @line.split("\t") unless @line.strip.empty? end |
#valid? ⇒ Boolean
42 43 44 45 |
# File 'lib/origen/tester/ultraflex/parser/pattern_set.rb', line 42 def valid? components[1] && !components[1].empty? && components[1] != 'Pattern Set' && components[2] && !components[2].empty? end |