Class: OrigenTesters::Decompiler::Pattern::Frontmatter

Inherits:
Base
  • Object
show all
Defined in:
lib/origen_testers/decompiler/pattern/elements/frontmatter.rb

Instance Attribute Summary

Attributes inherited from Base

#context, #node

Instance Method Summary collapse

Methods inherited from Base

#[], #execute!, #method_missing, #pinlist, #platform_nodes

Constructor Details

#initialize(node:, context:) ⇒ Frontmatter

Returns a new instance of Frontmatter.



7
8
9
10
# File 'lib/origen_testers/decompiler/pattern/elements/frontmatter.rb', line 7

def initialize(node:, context:)
  @source = :frontmatter
  super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class OrigenTesters::Decompiler::Pattern::Base

Instance Method Details

#commentsArray

Note:

This will <u>NOT</u> include the comment_header.

Returns all the comments, in the order they appear.

Returns:

  • (Array)

    Returns an array of comment blocks, where a comment block is an array of strings found in that block. The comment block can be recontructed into raw text by joining the array with the separator. If no comments were found, an empty array is returned.



26
27
28
# File 'lib/origen_testers/decompiler/pattern/elements/frontmatter.rb', line 26

def comments
  processor.comments
end

#pattern_headerArray

Returns the topmost comment block.

Returns:

  • (Array)

    Array representing the topmost common, split by the separator. If there is no comment header, an empty array is returned.



15
16
17
# File 'lib/origen_testers/decompiler/pattern/elements/frontmatter.rb', line 15

def pattern_header
  processor.pattern_header
end

#to_yaml_hashObject



30
31
32
33
34
35
36
37
38
# File 'lib/origen_testers/decompiler/pattern/elements/frontmatter.rb', line 30

def to_yaml_hash
  {
    class:          self.class.to_s,
    processor:      processor.class.to_s,
    pattern_header: pattern_header,
    comments:       comments,
    platform_nodes: _platform_nodes_
  }
end