Class: Feedx::Format::JSON::Decoder

Inherits:
Abstract::Decoder show all
Defined in:
lib/feedx/format/json.rb

Instance Method Summary collapse

Methods inherited from Abstract::Decoder

#close, #decode_each, #eof?

Methods inherited from Abstract::Wrapper

#initialize, open

Constructor Details

This class inherits a constructor from Feedx::Format::Abstract::Wrapper

Instance Method Details

#decode(target) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/feedx/format/json.rb', line 5

def decode(target, **)
  line = @io.gets
  return unless line

  target = target.allocate if target.is_a?(Class)
  target.from_json(line)
  target
end