Class: Ast::Merge::SectionTyping::TypedSection

Inherits:
Struct
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#metadataObject

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



56
57
58
# File 'lib/ast/merge/section_typing.rb', line 56

def 
  
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



56
57
58
# File 'lib/ast/merge/section_typing.rb', line 56

def name
  @name
end

#nodeObject

Returns the value of attribute node

Returns:

  • (Object)

    the current value of node



56
57
58
# File 'lib/ast/merge/section_typing.rb', line 56

def node
  @node
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



56
57
58
# File 'lib/ast/merge/section_typing.rb', line 56

def type
  @type
end

Instance Method Details

#normalized_nameString

Normalize the section name for matching.

Returns:

  • (String)

    Normalized name



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.

Returns:

  • (Boolean)


82
83
84
# File 'lib/ast/merge/section_typing.rb', line 82

def unclassified?
  type == :unclassified || type == :preamble
end