Class: TurboTest::StaticAnalysis::ActiveRecord::LineColumnStack

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/turbo_test_static_analysis/active_record_schema/sexp_builder/line_column_stack.rb

Instance Method Summary collapse

Constructor Details

#initializeLineColumnStack

Returns a new instance of LineColumnStack.



13
14
15
# File 'lib/turbo_test_static_analysis/active_record_schema/sexp_builder/line_column_stack.rb', line 13

def initialize
  @_stack = []
end

Instance Method Details

#push(line, column) ⇒ Object



17
18
19
20
# File 'lib/turbo_test_static_analysis/active_record_schema/sexp_builder/line_column_stack.rb', line 17

def push(line, column)
  line_column = [line, column]
  @_stack.push line_column unless @_stack.last == line_column
end

#remove_greater_than(line_column) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/turbo_test_static_analysis/active_record_schema/sexp_builder/line_column_stack.rb', line 22

def remove_greater_than(line_column)
  first_pop = nil
  while last && greater(last, line_column)
    line = pop
    first_pop ||= line
  end
  first_pop
end