Exception: Ast::Merge::FreezeNodeBase::InvalidStructureError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/ast/merge/freeze_node_base.rb

Overview

Error raised when a freeze block has invalid structure

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, start_line: nil, end_line: nil, unclosed_nodes: []) ⇒ InvalidStructureError

Returns a new instance of InvalidStructureError.

Parameters:

  • message (String)

    Error message

  • start_line (Integer, nil) (defaults to: nil)

    Start line number

  • end_line (Integer, nil) (defaults to: nil)

    End line number

  • unclosed_nodes (Array) (defaults to: [])

    Nodes causing the error



77
78
79
80
81
82
# File 'lib/ast/merge/freeze_node_base.rb', line 77

def initialize(message, start_line: nil, end_line: nil, unclosed_nodes: [])
  super(message)
  @start_line = start_line
  @end_line = end_line
  @unclosed_nodes = unclosed_nodes
end

Instance Attribute Details

#end_lineInteger? (readonly)

Returns Ending line of the freeze block.

Returns:

  • (Integer, nil)

    Ending line of the freeze block



68
69
70
# File 'lib/ast/merge/freeze_node_base.rb', line 68

def end_line
  @end_line
end

#start_lineInteger? (readonly)

Returns Starting line of the freeze block.

Returns:

  • (Integer, nil)

    Starting line of the freeze block



65
66
67
# File 'lib/ast/merge/freeze_node_base.rb', line 65

def start_line
  @start_line
end

#unclosed_nodesArray (readonly)

Returns Nodes that caused the structure error (optional).

Returns:

  • (Array)

    Nodes that caused the structure error (optional)



71
72
73
# File 'lib/ast/merge/freeze_node_base.rb', line 71

def unclosed_nodes
  @unclosed_nodes
end