Class: IcAgent::Candid::EmptyClass

Inherits:
PrimitiveType show all
Defined in:
lib/ic_agent/candid.rb

Instance Method Summary collapse

Methods inherited from PrimitiveType

#_build_type_table_impl, #check_type

Methods inherited from BaseType

_build_type_table_impl, #build_type_table, check_type, covariant, decode_value, #display, encode_type, encode_value

Constructor Details

#initializeEmptyClass

Returns a new instance of EmptyClass.



209
210
211
# File 'lib/ic_agent/candid.rb', line 209

def initialize
  super
end

Instance Method Details

#covariant(x) ⇒ Object



213
214
215
# File 'lib/ic_agent/candid.rb', line 213

def covariant(x)
  false
end

#decode_value(b, t) ⇒ Object

Raises:



225
226
227
# File 'lib/ic_agent/candid.rb', line 225

def decode_value(b, t)
  raise ValueError, 'Empty cannot appear as an output'
end

#encode_type(type_table = nil) ⇒ Object



221
222
223
# File 'lib/ic_agent/candid.rb', line 221

def encode_type(type_table = nil)
  LEB128.encode_signed(TypeIds::Empty).string
end

#encode_value(val) ⇒ Object

Raises:



217
218
219
# File 'lib/ic_agent/candid.rb', line 217

def encode_value(val)
  raise ValueError, 'Empty cannot appear as a function argument'
end

#idObject



233
234
235
# File 'lib/ic_agent/candid.rb', line 233

def id
  TypeIds::Empty
end

#nameObject



229
230
231
# File 'lib/ic_agent/candid.rb', line 229

def name
  'empty'
end