Class: EthereumContractABI::ContractInterface::AbiTypes::String
- Inherits:
-
BaseType
- Object
- BaseType
- EthereumContractABI::ContractInterface::AbiTypes::String
- Defined in:
- lib/ethereum-contract-abi/contract/abi_types/string.rb
Class Method Summary collapse
Instance Method Summary collapse
- #bytesize ⇒ Object
- #decode_value(value) ⇒ Object
- #encode_value(value) ⇒ Object
- #is_dynamic ⇒ Object
- #to_s ⇒ Object
- #valid_value?(value) ⇒ Boolean
Methods inherited from BaseType
Class Method Details
.from_string(string_type) ⇒ Object
38 39 40 |
# File 'lib/ethereum-contract-abi/contract/abi_types/string.rb', line 38 def self.from_string(string_type) string_type === 'string' ? self.new : nil end |
Instance Method Details
#bytesize ⇒ Object
20 21 22 |
# File 'lib/ethereum-contract-abi/contract/abi_types/string.rb', line 20 def bytesize nil end |
#decode_value(value) ⇒ Object
34 35 36 |
# File 'lib/ethereum-contract-abi/contract/abi_types/string.rb', line 34 def decode_value(value) StringDecoder.decode(value) end |
#encode_value(value) ⇒ Object
29 30 31 32 |
# File 'lib/ethereum-contract-abi/contract/abi_types/string.rb', line 29 def encode_value(value) raise ArgumentError unless valid_value?(value) BytesEncoder.encode(value) end |
#is_dynamic ⇒ Object
16 17 18 |
# File 'lib/ethereum-contract-abi/contract/abi_types/string.rb', line 16 def is_dynamic true end |
#to_s ⇒ Object
12 13 14 |
# File 'lib/ethereum-contract-abi/contract/abi_types/string.rb', line 12 def to_s "string" end |
#valid_value?(value) ⇒ Boolean
24 25 26 27 |
# File 'lib/ethereum-contract-abi/contract/abi_types/string.rb', line 24 def valid_value?(value) return false unless value.is_a? ::String true end |