Class: Ast::Merge::SectionTyping::TypedSection
- Inherits:
-
Struct
- Object
- Struct
- Ast::Merge::SectionTyping::TypedSection
- Defined in:
- lib/ast/merge/section_typing.rb
Overview
Represents a classified section from an AST node.
Unlike ‘Text::Section` which is text-based, this wraps actual AST nodes with their classification information.
Instance Attribute Summary collapse
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#name ⇒ Object
Returns the value of attribute name.
-
#node ⇒ Object
Returns the value of attribute node.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#normalized_name ⇒ String
Normalize the section name for matching.
-
#unclassified? ⇒ Boolean
Check if this is an unclassified/preamble section.
Instance Attribute Details
#metadata ⇒ Object
Returns the value of attribute metadata
56 57 58 |
# File 'lib/ast/merge/section_typing.rb', line 56 def end |
#name ⇒ Object
Returns the value of attribute name
56 57 58 |
# File 'lib/ast/merge/section_typing.rb', line 56 def name @name end |
#node ⇒ Object
Returns the value of attribute node
56 57 58 |
# File 'lib/ast/merge/section_typing.rb', line 56 def node @node end |
#type ⇒ Object
Returns the value of attribute type
56 57 58 |
# File 'lib/ast/merge/section_typing.rb', line 56 def type @type end |
Instance Method Details
#normalized_name ⇒ String
Normalize the section name for matching.
73 74 75 76 77 |
# File 'lib/ast/merge/section_typing.rb', line 73 def normalized_name return "" if name.nil? return name.to_s if name.is_a?(Symbol) name.to_s.strip.downcase end |
#unclassified? ⇒ Boolean
Check if this is an unclassified/preamble section.
82 83 84 |
# File 'lib/ast/merge/section_typing.rb', line 82 def unclassified? type == :unclassified || type == :preamble end |