Class: Blockchain::Address
- Inherits:
-
Object
- Object
- Blockchain::Address
- Defined in:
- lib/address.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#final_balance ⇒ Object
readonly
Returns the value of attribute final_balance.
-
#hash160 ⇒ Object
readonly
Returns the value of attribute hash160.
-
#total_received ⇒ Object
readonly
Returns the value of attribute total_received.
-
#total_sent ⇒ Object
readonly
Returns the value of attribute total_sent.
-
#txs ⇒ Object
readonly
Returns the value of attribute txs.
Class Method Summary collapse
Instance Method Summary collapse
- #==(o) ⇒ Object
- #firstseen ⇒ Object
-
#initialize(a) ⇒ Address
constructor
A new instance of Address.
- #n_tx ⇒ Object
- #n_unredeemed ⇒ Object
- #refresh! ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(a) ⇒ Address
10 11 12 |
# File 'lib/address.rb', line 10 def initialize(a) (a) end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
3 4 5 |
# File 'lib/address.rb', line 3 def address @address end |
#final_balance ⇒ Object (readonly)
Returns the value of attribute final_balance.
4 5 6 |
# File 'lib/address.rb', line 4 def final_balance @final_balance end |
#hash160 ⇒ Object (readonly)
Returns the value of attribute hash160.
3 4 5 |
# File 'lib/address.rb', line 3 def hash160 @hash160 end |
#total_received ⇒ Object (readonly)
Returns the value of attribute total_received.
3 4 5 |
# File 'lib/address.rb', line 3 def total_received @total_received end |
#total_sent ⇒ Object (readonly)
Returns the value of attribute total_sent.
4 5 6 |
# File 'lib/address.rb', line 4 def total_sent @total_sent end |
#txs ⇒ Object (readonly)
Returns the value of attribute txs.
4 5 6 |
# File 'lib/address.rb', line 4 def txs @txs end |
Class Method Details
.find(address) ⇒ Object
6 7 8 |
# File 'lib/address.rb', line 6 def self.find(address) self.new(Blockchain.rawaddr(address)) rescue nil end |
Instance Method Details
#==(o) ⇒ Object
38 39 40 |
# File 'lib/address.rb', line 38 def ==(o) o.instance_variables == self.instance_variables end |
#firstseen ⇒ Object
30 31 32 |
# File 'lib/address.rb', line 30 def firstseen DateTime.strptime(Blockchain.q("addressfirstseen/#{@address}"), '%s') end |
#n_tx ⇒ Object
22 23 24 |
# File 'lib/address.rb', line 22 def n_tx @n_tx || 0 end |
#n_unredeemed ⇒ Object
26 27 28 |
# File 'lib/address.rb', line 26 def n_unredeemed @n_unredeemed || 0 end |
#refresh! ⇒ Object
42 43 44 45 46 |
# File 'lib/address.rb', line 42 def refresh! address = @address instance_variables.each { |i| instance_variable_set(i, nil) } (Blockchain.rawaddr(address)) end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/address.rb', line 34 def to_s @address end |