Module: Toon
- Defined in:
- lib/toon.rb,
lib/toon/decoder.rb,
lib/toon/encoder.rb,
lib/toon/version.rb,
lib/extensions/core.rb,
lib/extensions/active_support.rb
Defined Under Namespace
Modules: Decoder, Encoder, Extensions Classes: Error
Constant Summary collapse
- VERSION =
'1.0.2'
Class Method Summary collapse
-
.dump(obj, io = STDOUT, **opts) ⇒ nil
Stream a TOON payload for
objinto the provided IO target. -
.generate(obj, **opts) ⇒ String
Generate a TOON-formatted String from any serializable Ruby object.
-
.load(io, **opts) ⇒ Object
Read a TOON payload from any IO-like object and parse it.
-
.parse(str, **opts) ⇒ Object
Parse a TOON String and reconstruct the Ruby data structure.
-
.pretty_generate(obj, **opts) ⇒ String
Generate a human-friendly TOON String with extra spacing and indentation.
Class Method Details
.dump(obj, io = STDOUT, **opts) ⇒ nil
Stream a TOON payload for obj into the provided IO target.
47 48 49 |
# File 'lib/toon.rb', line 47 def self.dump(obj, io = STDOUT, **opts) Toon::Encoder.dump(obj, io, **opts) end |
.generate(obj, **opts) ⇒ String
Generate a TOON-formatted String from any serializable Ruby object.
14 15 16 |
# File 'lib/toon.rb', line 14 def self.generate(obj, **opts) Toon::Encoder.generate(obj, **opts) end |
.load(io, **opts) ⇒ Object
Read a TOON payload from any IO-like object and parse it.
38 39 40 |
# File 'lib/toon.rb', line 38 def self.load(io, **opts) Toon::Decoder.load(io, **opts) end |
.parse(str, **opts) ⇒ Object
Parse a TOON String and reconstruct the Ruby data structure.
30 31 32 |
# File 'lib/toon.rb', line 30 def self.parse(str, **opts) Toon::Decoder.parse(str, **opts) end |
.pretty_generate(obj, **opts) ⇒ String
Generate a human-friendly TOON String with extra spacing and indentation.
22 23 24 |
# File 'lib/toon.rb', line 22 def self.pretty_generate(obj, **opts) Toon::Encoder.pretty_generate(obj, **opts) end |