Class: CLType
- Inherits:
-
Object
- Object
- CLType
- Defined in:
- lib/types/cl_type.rb
Direct Known Subclasses
CLAccountHashType, CLAnyType, CLBoolType, CLByteArrayType, CLI32Type, CLI64Type, CLKeyType, CLListType, CLMapType, CLOptionType, CLPublicKeyType, CLResultType, CLStringType, CLTupleType, CLU128Type, CLU256Type, CLU32Type, CLU512Type, CLU64Type, CLU8Type, CLURefType, CLUnitType
Constant Summary collapse
- TAGS =
{ # Boolean primitive. Bool: 0, # Signed 32-bit integer primitive. I32: 1, # Signed 64-bit integer primitive. I64: 2, # Unsigned 8-bit integer primitive. U8: 3, # Unsigned 32-bit integer primitive. U32: 4, # Unsigned 64-bit integer primitive. U64: 5, # Unsigned 128-bit integer primitive. U128: 6, # Unsigned 256-bit integer primitive. U256: 7, # Unsigned 512-bit integer primitive. U512: 8, # Singleton value without additional semantics. Unit: 9, # A string. e.g. "Hello, World!". String: 10, # Global state key. Key: 11, # Unforgeable reference. URef: 12, # Optional value of the given type Option(CLType). Option: 13, # Variable-length list of values of a single `CLType` List(CLType). List: 14, # Fixed-length list of a single `CLType` (normally a Byte). ByteArray: 15, # Co-product of the the given types; one variant meaning success, the other failure. Result: 16, # Key-value association where keys and values have the given types Map(CLType, CLType). Map: 17, # Single value of the given type Tuple1(CLType). Tuple1: 18, # Pair consisting of elements of the given types Tuple2(CLType, CLType). Tuple2: 19, # Triple consisting of elements of the given types Tuple3(CLType, CLType, CLType). Tuple3: 20, # Indicates the type is not known. Any: 21, # A Public key. PublicKey: 22 }
Instance Method Summary collapse
- #get_cl_type_tag(key) ⇒ Object
- #get_link_to ⇒ Object
- #get_tag_key(value) ⇒ String
-
#get_tag_value ⇒ Integer
Tag_value.
- #get_tags ⇒ Object
-
#initialize(value = nil) ⇒ CLType
constructor
A new instance of CLType.
-
#tag_value_isvalid(value) ⇒ Boolean
True or false.
- #to_json ⇒ Object
- #to_string ⇒ String
Constructor Details
#initialize(value = nil) ⇒ CLType
Returns a new instance of CLType.
53 54 55 |
# File 'lib/types/cl_type.rb', line 53 def initialize(value = nil) @value = value end |
Instance Method Details
#get_cl_type_tag(key) ⇒ Object
70 71 72 |
# File 'lib/types/cl_type.rb', line 70 def get_cl_type_tag(key) TAGS[key] end |
#get_link_to ⇒ Object
66 67 68 |
# File 'lib/types/cl_type.rb', line 66 def get_link_to end |
#get_tag_key(value) ⇒ String
76 77 78 |
# File 'lib/types/cl_type.rb', line 76 def get_tag_key(value) TAGS.key(value).to_s end |
#get_tag_value ⇒ Integer
Returns tag_value.
81 82 83 |
# File 'lib/types/cl_type.rb', line 81 def get_tag_value @tag_value end |
#get_tags ⇒ Object
85 86 87 |
# File 'lib/types/cl_type.rb', line 85 def TAGS end |
#tag_value_isvalid(value) ⇒ Boolean
Returns true or false.
91 92 93 |
# File 'lib/types/cl_type.rb', line 91 def tag_value_isvalid(value) TAGS.has_value?(value) end |
#to_json ⇒ Object
62 63 64 |
# File 'lib/types/cl_type.rb', line 62 def to_json end |
#to_string ⇒ String
58 59 60 |
# File 'lib/types/cl_type.rb', line 58 def to_string end |