class Etherlite::Abi::LoadType
Constants
- MATCHER
Public Instance Methods
perform()
click to toggle source
# File lib/etherlite/commands/abi/load_type.rb, line 5 def perform parts = MATCHER.match @signature raise ArgumentError, "Invalid argument type #{@signature}" if parts.nil? type = build_base_type parts build_array_type type, parts end
Private Instance Methods
b1_128(_parts)
click to toggle source
# File lib/etherlite/commands/abi/load_type.rb, line 47 def b1_128(_parts) _parts[:b1].nil? ? 128 : _parts[:b1].to_i end
b1_256(_parts)
click to toggle source
# File lib/etherlite/commands/abi/load_type.rb, line 43 def b1_256(_parts) _parts[:b1].nil? ? 256 : _parts[:b1].to_i end
b2_128(_parts)
click to toggle source
# File lib/etherlite/commands/abi/load_type.rb, line 51 def b2_128(_parts) _parts[:b2].nil? ? 128 : _parts[:b2].to_i end
build_array_type(_base_type, _parts)
click to toggle source
# File lib/etherlite/commands/abi/load_type.rb, line 33 def build_array_type(_base_type, _parts) return _base_type if _parts[:dim].nil? if _parts[:dim].empty? Etherlite::Types::ArrayDynamic.new _base_type else Etherlite::Types::ArrayFixed.new _base_type, _parts[:dim].to_i end end
build_base_type(_parts)
click to toggle source
# File lib/etherlite/commands/abi/load_type.rb, line 15 def build_base_type(_parts) # rubocop:disable Metrics/CyclomaticComplexity case _parts[:ty] when 'uint' then Etherlite::Types::Integer.new(false, b1_256(_parts)) when 'int' then Etherlite::Types::Integer.new(true, b1_256(_parts)) when 'ufixed' then Etherlite::Types::Fixed.new(false, b1_128(_parts), b2_128(_parts)) when 'fixed' then Etherlite::Types::Fixed.new(true, b1_128(_parts), b2_128(_parts)) when 'string' then Etherlite::Types::String.new when 'address' then Etherlite::Types::Address.new when 'bool' then Etherlite::Types::Boolean.new when 'bytes' if _parts[:b1].present? Etherlite::Types::Bytes.new(_parts[:b1].to_i) else Etherlite::Types::ByteString.new end end end