Module: GOBLExtensions::DocumentHelper::ClassMethods

Included in:
GOBL::Document
Defined in:
lib/gobl_extensions/document_helper.rb

Instance Method Summary collapse

Instance Method Details

#embed(struct) ⇒ Document

Embeds the given GOBL struct in a new document injecting the proper Schema ID.

Returns:

  • (Document)

    the document embedding the given struct



38
39
40
41
42
# File 'lib/gobl_extensions/document_helper.rb', line 38

def embed(struct)
  new struct.as_json.merge(
    '$schema' => struct.class::SCHEMA_ID
  )
end