Class: Ast::Merge::FreezeNodeBase::Location

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

Overview

Simple location struct for compatibility with AST nodes

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#end_lineObject

Returns the value of attribute end_line

Returns:

  • (Object)

    the current value of end_line



96
97
98
# File 'lib/ast/merge/freeze_node_base.rb', line 96

def end_line
  @end_line
end

#start_lineObject

Returns the value of attribute start_line

Returns:

  • (Object)

    the current value of start_line



96
97
98
# File 'lib/ast/merge/freeze_node_base.rb', line 96

def start_line
  @start_line
end

Instance Method Details

#cover?(line) ⇒ Boolean

Check if a line number is within this location

Parameters:

  • line (Integer)

    Line number to check

Returns:

  • (Boolean)


100
101
102
# File 'lib/ast/merge/freeze_node_base.rb', line 100

def cover?(line)
  (start_line..end_line).cover?(line)
end