Class: MemDump::JSONDump
- Inherits:
-
Object
- Object
- MemDump::JSONDump
- Defined in:
- lib/memdump/json_dump.rb
Instance Method Summary collapse
- #each_record ⇒ Object
-
#initialize(filename) ⇒ JSONDump
constructor
A new instance of JSONDump.
Constructor Details
#initialize(filename) ⇒ JSONDump
Returns a new instance of JSONDump.
4 5 6 |
# File 'lib/memdump/json_dump.rb', line 4 def initialize(filename) @filename = filename end |
Instance Method Details
#each_record ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/memdump/json_dump.rb', line 8 def each_record return enum_for(__method__) if !block_given? if @cached_entries @cached_entries.each(&proc) else @filename.open do |f| f.each_line do |line| yield JSON.parse(line) end end end end |