Module: FIRM

Defined in:
lib/firm/version.rb,
lib/firm/serializable.rb,
lib/firm/serialize/id.rb,
lib/firm/serialize/core.rb,
lib/firm/serializer/xml.rb,
lib/firm/serializer/json.rb,
lib/firm/serializer/yaml.rb

Overview

FIRM - multiple output ruby object serializer
Copyright © M.J.N. Corino, The Netherlands

Defined Under Namespace

Modules: Serializable

Constant Summary collapse

VERSION =

FIRM version

"1.1.2"

Class Method Summary collapse

Class Method Details

.deserialize(source, format: Serializable.default_format) ⇒ Object

Deserializes object from source data

Parameters:

  • source (IO, String)

    source data (String or IO(-like object))

  • format (Symbol, String) (defaults to: Serializable.default_format)

    data format of source

Returns:

  • (Object)

    deserialized object



789
790
791
# File 'lib/firm/serializable.rb', line 789

def self.deserialize(source, format: Serializable.default_format)
  Serializable.deserialize(source, format: format)
end

.serialize(obj, pretty: false, format: Serializable.default_format) ⇒ String .serialize(obj, io, pretty: false, format: Serializable.default_format) ⇒ IO

Serialize the given object

Overloads:

  • .serialize(obj, pretty: false, format: Serializable.default_format) ⇒ String

    Returns serialized data.

    Parameters:

    • obj (Object)

      object to serialize

    • pretty (Boolean) (defaults to: false)

      if true specifies to generate pretty formatted output if possible

    • format (Symbol, String) (defaults to: Serializable.default_format)

      specifies output format

    Returns:

    • (String)

      serialized data

  • .serialize(obj, io, pretty: false, format: Serializable.default_format) ⇒ IO

    Parameters:

    • obj (Object)

      object to serialize

    • io (IO)

      output stream (IO(-like object)) to write serialized data to

    • pretty (Boolean) (defaults to: false)

      if true specifies to generate pretty formatted output if possible

    • format (Symbol, String) (defaults to: Serializable.default_format)

      specifies output format

    Returns:

    • (IO)


781
782
783
# File 'lib/firm/serializable.rb', line 781

def self.serialize(obj, io = nil, pretty: false, format: Serializable.default_format)
  Serializable.serialize(obj, io, pretty: pretty, format: format)
end