Module: ToonFu::Encodable

Defined in:
lib/toon_fu/encodable.rb

Overview

Adds to_toon to the core and standard-library classes TOON encodes. BigDecimal is left out: it is a bundled gem the encoder accepts but does not load. Include this module into a class that defines as_toon to give that class to_toon as well.

Instance Method Summary collapse

Instance Method Details

#to_toon(**options) ⇒ String

Returns the receiver encoded as TOON, as ToonFu.encode would.

Parameters:

Returns:

  • (String) —

    the receiver encoded as TOON, as ToonFu.encode would

Raises:



12
13
14
# File 'lib/toon_fu/encodable.rb', line 12

def to_toon(**options)
  ToonFu.encode(self, **options)
end