Module: ContextSpook::TOON
- Included in:
- Generator::Context
- Defined in:
- lib/context_spook/toon.rb
Overview
The ContextSpook::TOON module provides TOON (Token-Oriented Object Notation) serialization functionality for context objects.
Instance Method Summary collapse
-
#to_toon ⇒ String
Converts the context object to TOON format.
-
#toon_example ⇒ String
The toon_example method reads and returns the content of an example Markdown file that demonstrates the TOON (Token-Oriented Object Notation) format.
-
#toon_size ⇒ Integer
Calculates the size of the TOON representation.
Instance Method Details
#to_toon ⇒ String
Converts the context object to TOON format.
9 10 11 |
# File 'lib/context_spook/toon.rb', line 9 def to_toon ::Toon.encode(as_json) end |
#toon_example ⇒ String
The toon_example method reads and returns the content of an example Markdown file that demonstrates the TOON (Token-Oriented Object Notation) format.
This method is used to provide a sample representation of how context data can be formatted in TOON, which is an alternative serialization format supported by the ContextSpook library.
30 31 32 |
# File 'lib/context_spook/toon.rb', line 30 def toon_example File.read(Pathname.new(__dir__) + 'toon/example.md') end |
#toon_size ⇒ Integer
Calculates the size of the TOON representation.
17 18 19 |
# File 'lib/context_spook/toon.rb', line 17 def toon_size to_toon.size end |