Class: Y::Transaction
- Inherits:
-
Object
- Object
- Y::Transaction
- Defined in:
- lib/y/transaction.rb
Instance Attribute Summary collapse
-
#document ⇒ Y::Doc
The document this array belongs to.
Instance Method Summary collapse
-
#apply(update) ⇒ void
Applies the encoded update on this document.
-
#apply_v2(update) ⇒ void
Applies the v2 encoded update on this document.
-
#commit ⇒ void
Commits transaction.
-
#get_array(name) ⇒ Y::Array
Create or get array type.
-
#get_map(name) ⇒ Y::Map
Create or get map type.
-
#get_text(name) ⇒ Y::Text
Create or get text type.
-
#get_xml_element(name) ⇒ Y::XMLElement
Create or get XMLElement type.
-
#get_xml_fragment(name) ⇒ Y::XMLFragment
Create or get XMLFragment type.
-
#get_xml_text(name) ⇒ Y::XMLText
Create or get XMLText type.
-
#initialize(doc = nil) ⇒ Transaction
constructor
A new instance of Transaction.
-
#state ⇒ ::Array<Integer>
Return a state vector for this transaction.
-
#state_v2 ⇒ ::Array<Integer>
Returns a v2 state vector for this transaction.
Constructor Details
#initialize(doc = nil) ⇒ Transaction
Returns a new instance of Transaction.
10 11 12 13 14 |
# File 'lib/y/transaction.rb', line 10 def initialize(doc = nil) @document = doc super() end |
Instance Attribute Details
#document ⇒ Y::Doc
Returns The document this array belongs to.
8 9 10 |
# File 'lib/y/transaction.rb', line 8 def document @document end |
Instance Method Details
#apply(update) ⇒ void
This method returns an undefined value.
Applies the encoded update on this document. This will bring the the document to the same state as the one the update is from.
21 22 23 |
# File 'lib/y/transaction.rb', line 21 def apply(update) ytransaction_apply_update(update) end |
#apply_v2(update) ⇒ void
This method returns an undefined value.
Applies the v2 encoded update on this document. This will bring the the document to the same state as the one the update is from.
30 31 32 |
# File 'lib/y/transaction.rb', line 30 def apply_v2(update) ytransaction_apply_update_v2(update) end |
#commit ⇒ void
This method returns an undefined value.
Commits transaction
37 38 39 |
# File 'lib/y/transaction.rb', line 37 def commit ytransaction_commit end |
#get_array(name) ⇒ Y::Array
Create or get array type
45 46 47 48 49 |
# File 'lib/y/transaction.rb', line 45 def get_array(name) array = ytransaction_get_array(name) array.document = document array end |
#get_map(name) ⇒ Y::Map
Create or get map type
55 56 57 58 59 |
# File 'lib/y/transaction.rb', line 55 def get_map(name) map = ytransaction_get_map(name) map.document = document map end |
#get_text(name) ⇒ Y::Text
Create or get text type
65 66 67 68 69 |
# File 'lib/y/transaction.rb', line 65 def get_text(name) text = ytransaction_get_text(name) text.document = document text end |
#get_xml_element(name) ⇒ Y::XMLElement
Create or get XMLElement type
75 76 77 78 79 |
# File 'lib/y/transaction.rb', line 75 def get_xml_element(name) xml_element = ytransaction_get_xml_element(name) xml_element.document = document xml_element end |
#get_xml_fragment(name) ⇒ Y::XMLFragment
Create or get XMLFragment type
85 86 87 88 89 |
# File 'lib/y/transaction.rb', line 85 def get_xml_fragment(name) xml_fragment = ytransaction_get_xml_fragment(name) xml_fragment.document = document xml_fragment end |
#get_xml_text(name) ⇒ Y::XMLText
Create or get XMLText type
95 96 97 98 99 |
# File 'lib/y/transaction.rb', line 95 def get_xml_text(name) xml_text = ytransaction_get_xml_text(name) xml_text.document = document xml_text end |
#state ⇒ ::Array<Integer>
Return a state vector for this transaction
104 105 106 |
# File 'lib/y/transaction.rb', line 104 def state ytransaction_state_vector end |
#state_v2 ⇒ ::Array<Integer>
Returns a v2 state vector for this transaction
111 112 113 |
# File 'lib/y/transaction.rb', line 111 def state_v2 ytransaction_state_vector_v2 end |