Class: Alf::Reader::JSON
- Inherits:
-
Alf::Reader
- Object
- Alf::Reader
- Alf::Reader::JSON
- Defined in:
- lib/alf-io/alf/reader/json.rb
Overview
Implements Alf::Reader contract for reading JSON input.
Constant Summary
Constants inherited from Alf::Reader
Instance Attribute Summary
Attributes inherited from Alf::Reader
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Alf::Reader
by_mime_type, coerce, #initialize, reader, register
Methods included from Support::Registry
#listen, #listeners, #register, #registered
Methods included from Engine::Cog
Constructor Details
This class inherits a constructor from Alf::Reader
Class Method Details
.mime_type ⇒ Object
8 9 10 |
# File 'lib/alf-io/alf/reader/json.rb', line 8 def self.mime_type "application/json" end |
Instance Method Details
#each ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/alf-io/alf/reader/json.rb', line 12 def each return to_enum unless block_given? require 'json' p = ::JSON.parse(input_text, create_additions: false) p = [p] if TupleLike===p p.each do |t| yield Support.symbolize_keys(t) end end |