class MongoHTTPSync::Parser::Handler
Attributes
ndocs[R]
Public Class Methods
new(block)
click to toggle source
# File lib/mongo_http_sync/parser.rb, line 12 def initialize(block) @block = block @level = 0 @ndocs = 0 end
Public Instance Methods
array_append(a,v)
click to toggle source
# File lib/mongo_http_sync/parser.rb, line 41 def array_append(a,v) a << v end
array_start()
click to toggle source
# File lib/mongo_http_sync/parser.rb, line 37 def array_start [] end
error(message, line, column)
click to toggle source
# File lib/mongo_http_sync/parser.rb, line 45 def error(message, line, column) throw "#{message} (line: #{line}, column: #{column})" end
hash_end()
click to toggle source
# File lib/mongo_http_sync/parser.rb, line 25 def hash_end @level -= 1 if @level.zero? @block.call @root_hash if @level.zero? @ndocs += 1 end end
hash_set(h,k,v)
click to toggle source
# File lib/mongo_http_sync/parser.rb, line 33 def hash_set(h,k,v) h[k.to_sym] = v end
hash_start()
click to toggle source
# File lib/mongo_http_sync/parser.rb, line 18 def hash_start @hash = {} @root_hash = @hash if @level.zero? @level += 1 @hash end