Class: NWRFC::Transaction
- Inherits:
-
Object
- Object
- NWRFC::Transaction
- Defined in:
- lib/nwrfc.rb
Instance Attribute Summary collapse
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
Instance Method Summary collapse
- #close ⇒ Object (also: #destroy)
- #commit ⇒ Object (also: #submit)
-
#initialize(handle) ⇒ Transaction
constructor
A new instance of Transaction.
Constructor Details
#initialize(handle) ⇒ Transaction
Returns a new instance of Transaction.
129 130 131 132 133 134 |
# File 'lib/nwrfc.rb', line 129 def initialize(handle) @handle = handle @error = NWRFCLib::RFCError.new @submitted = false @confirmed = false end |
Instance Attribute Details
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
127 128 129 |
# File 'lib/nwrfc.rb', line 127 def handle @handle end |
Instance Method Details
#close ⇒ Object Also known as: destroy
150 151 152 153 154 155 |
# File 'lib/nwrfc.rb', line 150 def close return unless @handle rc = NWRFCLib.destroy_transaction(@handle, @error) NWRFC.check_error(@error) if rc > 0 @handle = nil end |
#commit ⇒ Object Also known as: submit
136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/nwrfc.rb', line 136 def commit unless @submitted rc = NWRFCLib.submit_transaction(@handle, @error) NWRFC.check_error(@error) if rc > 0 @submitted = true end unless @confirmed rc = NWRFCLib.confirm_transaction(@handle, @error) NWRFC.check_error(@error) if rc > 0 @confirmed = true end close end |