Class: Ibex::TableArtifact::Document
- Inherits:
-
Object
- Object
- Ibex::TableArtifact::Document
- Defined in:
- lib/ibex/table_artifact/document.rb
Overview
An immutable, validated table artifact document.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
@rbs! type json_value = String | Integer | Float | bool | nil | Array | Hash[String, json_value].
Instance Method Summary collapse
- #cost ⇒ Object
- #dump ⇒ Object
- #identity ⇒ Object
-
#initialize(data) ⇒ Document
constructor
A new instance of Document.
- #payload ⇒ Object
Constructor Details
#initialize(data) ⇒ Document
Returns a new instance of Document.
13 14 15 16 |
# File 'lib/ibex/table_artifact/document.rb', line 13 def initialize(data) Validator.validate!(data) @data = Serializer.deep_freeze(data) end |
Instance Attribute Details
#data ⇒ Object (readonly)
@rbs! type json_value = String | Integer | Float | bool | nil | Array | Hash[String, json_value]
10 11 12 |
# File 'lib/ibex/table_artifact/document.rb', line 10 def data @data end |
Instance Method Details
#cost ⇒ Object
34 35 36 |
# File 'lib/ibex/table_artifact/document.rb', line 34 def cost @data.fetch("cost") #: Hash[String, json_value] end |
#dump ⇒ Object
19 20 21 |
# File 'lib/ibex/table_artifact/document.rb', line 19 def dump Serializer.dump(@data) end |
#identity ⇒ Object
29 30 31 |
# File 'lib/ibex/table_artifact/document.rb', line 29 def identity @data.fetch("identity") #: Hash[String, String] end |
#payload ⇒ Object
24 25 26 |
# File 'lib/ibex/table_artifact/document.rb', line 24 def payload @data.fetch("payload") #: Hash[String, json_value] end |