Class: IcAgent::Candid::IntClass

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

#initializeIntClass

Returns a new instance of IntClass.



347
348
349
# File 'lib/ic_agent/candid.rb', line 347

def initialize
  super
end

Instance Method Details

#covariant(x) ⇒ Object



351
352
353
# File 'lib/ic_agent/candid.rb', line 351

def covariant(x)
  x.is_a?(Integer)
end

#decode_value(b, t) ⇒ Object



363
364
365
366
# File 'lib/ic_agent/candid.rb', line 363

def decode_value(b, t)
  check_type(t)
  IcAgent::Candid.leb128i_decode(b)
end

#encode_type(type_table = nil) ⇒ Object



359
360
361
# File 'lib/ic_agent/candid.rb', line 359

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

#encode_value(val) ⇒ Object



355
356
357
# File 'lib/ic_agent/candid.rb', line 355

def encode_value(val)
  LEB128.encode_signed(val).string
end

#idObject



372
373
374
# File 'lib/ic_agent/candid.rb', line 372

def id
  TypeIds::Int
end

#nameObject



368
369
370
# File 'lib/ic_agent/candid.rb', line 368

def name
  'int'
end