Class: IcAgent::Candid::TextClass
Instance Method Summary
collapse
#_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
Returns a new instance of TextClass.
312
313
314
|
# File 'lib/ic_agent/candid.rb', line 312
def initialize
super
end
|
Instance Method Details
#covariant(x) ⇒ Object
316
317
318
|
# File 'lib/ic_agent/candid.rb', line 316
def covariant(x)
x.is_a?(String)
end
|
#decode_value(b, t) ⇒ Object
#encode_type(type_table = nil) ⇒ Object
326
327
328
|
# File 'lib/ic_agent/candid.rb', line 326
def encode_type(type_table = nil)
LEB128.encode_signed(TypeIds::Text).string
end
|
#encode_value(val) ⇒ Object
320
321
322
323
324
|
# File 'lib/ic_agent/candid.rb', line 320
def encode_value(val)
buf = val.encode(Encoding::UTF_8)
length = LEB128.encode_signed(buf.length).string
length + buf
end
|
#id ⇒ Object
341
342
343
|
# File 'lib/ic_agent/candid.rb', line 341
def id
TypeIds::Text
end
|
#name ⇒ Object
337
338
339
|
# File 'lib/ic_agent/candid.rb', line 337
def name
'text'
end
|