Class: CLTypeTag

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

Constant Summary collapse

TAGS =
{
  Bool: 0,
  I32: 1,
  I64: 2,
  U8: 3,
  U32: 4,
  U64: 5,
  U128: 6,
  U256: 7,
  U512: 8,
  Unit: 9,
  String: 10,
  Key: 11,
  URef: 12,
  Option: 13,
  List: 14,
  ByteArray: 15,
  Result: 16,
  Map: 17,
  Tuple1: 18,
  Tuple2: 19,
  Tuple3: 20,
  Any: 21,
  PublicKey: 22
}

Instance Method Summary collapse

Constructor Details

#initialize(tag_value) ⇒ CLTypeTag

Constructor

Parameters:

  • tag_value (Integer)


31
32
33
# File 'lib/types/cl_type_tag.rb', line 31

def initialize(tag_value)
  @tag_value = tag_value
end

Instance Method Details

#get_tag_nameString

Returns:

  • (String)


48
49
50
# File 'lib/types/cl_type_tag.rb', line 48

def get_tag_name
  TAGS.key(@tag_value).to_s
end

#get_tag_valueInteger

Returns tag_value.

Returns:

  • (Integer)

    tag_value



43
44
45
# File 'lib/types/cl_type_tag.rb', line 43

def get_tag_value
  @tag_value
end

#tag_value_isvalid(tag_value) ⇒ Boolean

Returns true or false.

Parameters:

  • tag_value (Integer)

Returns:



37
38
39
40
# File 'lib/types/cl_type_tag.rb', line 37

def tag_value_isvalid(tag_value)
  TAGS.has_value?(tag_value)
  # "#{tag_value} is invalid CLType tag"
end