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



88
89
90
# File 'lib/ast/merge/freeze_node_base.rb', line 88

def end_line
  @end_line
end

#start_lineObject

Returns the value of attribute start_line

Returns:

  • (Object)

    the current value of start_line



88
89
90
# File 'lib/ast/merge/freeze_node_base.rb', line 88

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)


92
93
94
# File 'lib/ast/merge/freeze_node_base.rb', line 92

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