Class: CSV::Parser::Scanner

Inherits:
StringScanner
  • Object
show all
Defined in:
lib/csv/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Scanner

Returns a new instance of Scanner.



19
20
21
22
# File 'lib/csv/parser.rb', line 19

def initialize(*args)
  super
  @keeps = []
end

Instance Method Details

#keep_backObject



33
34
35
# File 'lib/csv/parser.rb', line 33

def keep_back
  self.pos = @keeps.pop
end

#keep_dropObject



37
38
39
# File 'lib/csv/parser.rb', line 37

def keep_drop
  @keeps.pop
end

#keep_endObject



28
29
30
31
# File 'lib/csv/parser.rb', line 28

def keep_end
  start = @keeps.pop
  string[start, pos - start]
end

#keep_startObject



24
25
26
# File 'lib/csv/parser.rb', line 24

def keep_start
  @keeps.push(pos)
end