lib/json/streamer/json_streamer.rb in json-streamer-1.2.1 vs lib/json/streamer/json_streamer.rb in json-streamer-1.3.0

- old
+ new

@@ -25,14 +25,15 @@ def <<(data) @parser << data end # Callbacks containing `yield` have to be defined in the method called via block otherwise yield won't work - def get(nesting_level: -1, key: nil, yield_values: true) + def get(nesting_level: -1, key: nil, yield_values: true, symbolize_keys: false) @yield_level = nesting_level @yield_key = key @yield_values = yield_values + @symbolize_keys = symbolize_keys @parser.value do |v| value(v) { |desired_object| yield desired_object } end @@ -54,10 +55,10 @@ def start_array new_level(Array.new) end def key(k) - @current_key = k + @current_key = @symbolize_keys ? k.to_sym : k end def value(value) reset_current_key if array_level?(@current_level) yield value if yield_value?