Class: GOBL::Object

Inherits:
Struct show all
Includes:
Hashme
Defined in:
lib/gobl/object.rb

Overview

Base class for object structs with properties in the GOBL Schema

Class Method Summary collapse

Methods inherited from Struct

#as_json, from_data, from_json!, #to_json

Class Method Details

.new(attrs) ⇒ Object

Returns a GOBL object from a given hash of attributes. Nested attributes are supported: the constructor will instantiate the proper GOBL objects when nested hashes or arrays are given as part of the ‘attrs` parameter.

The ‘new` method will only allow to create a new object if all attributes marked as mandatory and not calculated in the JSON schema are provided.

Parameters:

  • attrs (Hash)

    the hash of attributes

Returns:

  • (Object)

    the object corresponding to the given input



# File 'lib/gobl/object.rb', line 8