Class: Bitcoin::Account
- Inherits:
-
Object
- Object
- Bitcoin::Account
- Defined in:
- lib/bitcoin/account.rb
Overview
Instance Attribute Summary (collapse)
-
- (Object) identifier
readonly
The account identifier or label.
Instance Method Summary (collapse)
-
- (Object) ==(other)
Compare two accounts.
-
- (Float) balance
Return the current balance of this account.
-
- (Account) initialize(account_label = '', balance = nil)
constructor
A new instance of Account.
-
- (String) to_s
String representation of an Account.
Constructor Details
- (Account) initialize(account_label = '', balance = nil)
A new instance of Account
11 12 13 14 |
# File 'lib/bitcoin/account.rb', line 11 def initialize(account_label = '', balance = nil) @identifier = account_label @balance = balance end |
Instance Attribute Details
- (Object) identifier (readonly)
The account identifier or label.
9 10 11 |
# File 'lib/bitcoin/account.rb', line 9 def identifier @identifier end |
Instance Method Details
- (Object) ==(other)
Compare two accounts.
Two accounts are deemed the same if their labels match.
42 43 44 |
# File 'lib/bitcoin/account.rb', line 42 def ==(other) to_s == other.to_s end |
- (Float) balance
Return the current balance of this account.
Note that this balance would have been generated with a specified number of minimum confirmations which means it may include or exclude unconfirmed transactions. If however no balance has been retrieved it will retrieve one with a default minimum confimration count of 1.
24 25 26 |
# File 'lib/bitcoin/account.rb', line 24 def balance @balance ||= Bitcoin::Client.get_balance(@identifier) end |
- (String) to_s
String representation of an Account.
35 36 37 |
# File 'lib/bitcoin/account.rb', line 35 def to_s identifier end |