Class: Rbs::Merge::FreezeNode
- Inherits:
-
Ast::Merge::FreezeNodeBase
- Object
- Ast::Merge::FreezeNodeBase
- Rbs::Merge::FreezeNode
- Defined in:
- lib/rbs/merge/freeze_node.rb
Overview
Wrapper to represent freeze blocks as first-class nodes in RBS files. A freeze block is a section marked with freeze/unfreeze comment markers that should be preserved from the destination during merges.
Inherits from Ast::Merge::FreezeNodeBase for shared functionality including the Location struct, InvalidStructureError, and configurable marker patterns.
Uses the ‘:hash_comment` pattern type by default for RBS type signature files.
Constant Summary collapse
- InvalidStructureError =
Inherit InvalidStructureError from base class
Ast::Merge::FreezeNodeBase::InvalidStructureError
- Location =
Inherit Location from base class
Ast::Merge::FreezeNodeBase::Location
Instance Method Summary collapse
-
#initialize(start_line:, end_line:, analysis:, nodes: [], overlapping_nodes: nil, start_marker: nil, end_marker: nil, pattern_type: Ast::Merge::FreezeNodeBase::DEFAULT_PATTERN) ⇒ FreezeNode
constructor
A new instance of FreezeNode.
-
#inspect ⇒ String
String representation for debugging.
-
#signature ⇒ Array
Returns a stable signature for this freeze block Signature includes the normalized content to detect changes.
Constructor Details
#initialize(start_line:, end_line:, analysis:, nodes: [], overlapping_nodes: nil, start_marker: nil, end_marker: nil, pattern_type: Ast::Merge::FreezeNodeBase::DEFAULT_PATTERN) ⇒ FreezeNode
Returns a new instance of FreezeNode.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/rbs/merge/freeze_node.rb', line 39 def initialize(start_line:, end_line:, analysis:, nodes: [], overlapping_nodes: nil, start_marker: nil, end_marker: nil, pattern_type: Ast::Merge::FreezeNodeBase::DEFAULT_PATTERN) super( start_line: start_line, end_line: end_line, analysis: analysis, nodes: nodes, overlapping_nodes: overlapping_nodes || nodes, start_marker: start_marker, end_marker: end_marker, pattern_type: pattern_type ) # Validate structure validate_structure! end |
Instance Method Details
#inspect ⇒ String
String representation for debugging
68 69 70 |
# File 'lib/rbs/merge/freeze_node.rb', line 68 def inspect "#<Rbs::Merge::FreezeNode lines=#{@start_line}..#{@end_line} nodes=#{@nodes.length}>" end |
#signature ⇒ Array
Returns a stable signature for this freeze block Signature includes the normalized content to detect changes
58 59 60 61 62 63 64 |
# File 'lib/rbs/merge/freeze_node.rb', line 58 def signature normalized = (@start_line..@end_line).map do |ln| @analysis.normalized_line(ln) end.compact.join("\n") [:FreezeNode, normalized] end |