Class: EthereumContractABI::ContractInterface::AbiTypes::Uint
- Inherits:
-
Int
- Object
- BaseType
- Int
- EthereumContractABI::ContractInterface::AbiTypes::Uint
show all
- Defined in:
- lib/ethereum-contract-abi/contract/abi_types/uint.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Int
#decode_value, #encode_value, #initialize
Methods inherited from BaseType
#bytesize, #decode_value, #encode_value, #is_type_equal
Class Method Details
.from_string(string_type) ⇒ Object
22
23
24
25
26
|
# File 'lib/ethereum-contract-abi/contract/abi_types/uint.rb', line 22
def self.from_string(string_type)
/(?<is_uint>uint)(?<bits>\d+)?/ =~ string_type
return nil unless is_uint
bits ? self.new(bits.to_i) : self.new
end
|
Instance Method Details
#is_dynamic ⇒ Object
14
15
16
|
# File 'lib/ethereum-contract-abi/contract/abi_types/uint.rb', line 14
def is_dynamic
false
end
|
#to_s ⇒ Object
10
11
12
|
# File 'lib/ethereum-contract-abi/contract/abi_types/uint.rb', line 10
def to_s
"uint#{@bits}"
end
|
#valid_value?(number) ⇒ Boolean
18
19
20
|
# File 'lib/ethereum-contract-abi/contract/abi_types/uint.rb', line 18
def valid_value?(number)
super(number) && number >= 0
end
|