Module: Raiblocks::AccountsProxyHelper
- Included in:
- Accounts
- Defined in:
- lib/raiblocks/helpers/accounts_proxy_helper.rb
Instance Method Summary collapse
- #<<(val) ⇒ Object
-
#[](idx) ⇒ Object
Array-like access for Raiblocks::Account.
- #balances ⇒ Object
- #create(wallet:, count:, work: nil) ⇒ Object
- #each(&_block) ⇒ Object
- #first ⇒ Object
- #frontiers ⇒ Object
- #pending(count:, threshold: nil, source: nil) ⇒ Object (also: #pending_blocks)
- #second ⇒ Object
- #third ⇒ Object
Instance Method Details
#<<(val) ⇒ Object
27 28 29 |
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 27 def <<(val) @addresses << val end |
#[](idx) ⇒ Object
Array-like access for Raiblocks::Account
21 22 23 24 25 |
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 21 def [](idx) return unless @addresses[idx] @account_objects ||= [] @account_objects[idx] ||= Raiblocks::Account.new(@addresses[idx]) end |
#balances ⇒ Object
7 8 9 |
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 7 def balances accounts_balances.balances end |
#create(wallet:, count:, work: nil) ⇒ Object
11 12 13 |
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 11 def create(wallet:, count:, work: nil) accounts_create(wallet: wallet, count: count, work: work).accounts end |
#each(&_block) ⇒ Object
31 32 33 34 35 |
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 31 def each(&_block) @addresses.each do |address| yield Raiblocks::Account.new(address) end end |
#first ⇒ Object
37 38 39 |
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 37 def first self[0] end |
#frontiers ⇒ Object
3 4 5 |
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 3 def frontiers accounts_frontiers.frontiers end |
#pending(count:, threshold: nil, source: nil) ⇒ Object Also known as: pending_blocks
15 16 17 |
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 15 def pending(count:, threshold: nil, source: nil) accounts_pending(count: count, threshold: threshold, source: source).blocks end |
#second ⇒ Object
41 42 43 |
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 41 def second self[1] end |
#third ⇒ Object
45 46 47 |
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 45 def third self[2] end |