Class: Web3::Hpb::Log

Inherits:
Object
  • Object
show all
Defined in:
lib/web3/hpb/log.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(log) ⇒ Log

Returns a new instance of Log.



7
8
9
10
11
12
13
# File 'lib/web3/hpb/log.rb', line 7

def initialize(log)
  @raw_data = log
  log.each do |k, v|
    self.instance_variable_set("@#{k}", v)
    self.class.send(:define_method, k, proc{ self.instance_variable_get("@#{k}")})
  end
end

Instance Attribute Details

#raw_dataObject (readonly)

Returns the value of attribute raw_data.



5
6
7
# File 'lib/web3/hpb/log.rb', line 5

def raw_data
  @raw_data
end

Instance Method Details

#has_topics?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/web3/hpb/log.rb', line 15

def has_topics?
  !!topics.first
end

#indexed_argsObject



23
24
25
# File 'lib/web3/hpb/log.rb', line 23

def indexed_args
  topics[1...topics.size].collect{ |x| x[2..65] }
end

#method_hashObject



19
20
21
# File 'lib/web3/hpb/log.rb', line 19

def method_hash
  topics.first && topics.first[2..65]
end