class IcAgent::Candid::TextClass
Represents an IDL Text
Public Class Methods
new()
click to toggle source
Calls superclass method
IcAgent::Candid::PrimitiveType::new
# File lib/ic_agent/candid.rb, line 318 def initialize super end
Public Instance Methods
covariant(x)
click to toggle source
# File lib/ic_agent/candid.rb, line 322 def covariant(x) x.is_a?(String) end
decode_value(b, t)
click to toggle source
# File lib/ic_agent/candid.rb, line 336 def decode_value(b, t) check_type(t) length = IcAgent::Candid.leb128u_decode(b).to_i buf = IcAgent::Candid.safe_read(b, length) buf.hex2str end
encode_type(type_table = nil)
click to toggle source
# File lib/ic_agent/candid.rb, line 332 def encode_type(type_table = nil) LEB128.encode_signed(TypeIds::Text).string end
encode_value(val)
click to toggle source
# File lib/ic_agent/candid.rb, line 326 def encode_value(val) buf = val.encode(Encoding::UTF_8) length = LEB128.encode_signed(buf.length).string length + buf end
id()
click to toggle source
# File lib/ic_agent/candid.rb, line 347 def id TypeIds::Text end
name()
click to toggle source
# File lib/ic_agent/candid.rb, line 343 def name 'text' end