Class: Blockchain::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/address.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(a) ⇒ Address



10
11
12
# File 'lib/address.rb', line 10

def initialize(a)
  meta_init(a)
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



3
4
5
# File 'lib/address.rb', line 3

def address
  @address
end

#final_balanceObject (readonly)

Returns the value of attribute final_balance.



4
5
6
# File 'lib/address.rb', line 4

def final_balance
  @final_balance
end

#hash160Object (readonly)

Returns the value of attribute hash160.



3
4
5
# File 'lib/address.rb', line 3

def hash160
  @hash160
end

#total_receivedObject (readonly)

Returns the value of attribute total_received.



3
4
5
# File 'lib/address.rb', line 3

def total_received
  @total_received
end

#total_sentObject (readonly)

Returns the value of attribute total_sent.



4
5
6
# File 'lib/address.rb', line 4

def total_sent
  @total_sent
end

#txsObject (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

#firstseenObject



30
31
32
# File 'lib/address.rb', line 30

def firstseen
  DateTime.strptime(Blockchain.q("addressfirstseen/#{@address}"), '%s')
end

#n_txObject



22
23
24
# File 'lib/address.rb', line 22

def n_tx
  @n_tx || 0
end

#n_unredeemedObject



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) }
  meta_init(Blockchain.rawaddr(address))
end

#to_sObject



34
35
36
# File 'lib/address.rb', line 34

def to_s
  @address
end