class IcAgent::Candid::RecClass
Represents a reference to an IDL type, used for defining recursive data types.
Public Class Methods
new()
click to toggle source
Calls superclass method
IcAgent::Candid::ConstructType::new
# File lib/ic_agent/candid.rb, line 1020 def initialize super() @id = @@counter @@counter += 1 @type = nil end
Public Instance Methods
_build_type_table_impl(type_table)
click to toggle source
# File lib/ic_agent/candid.rb, line 1061 def _build_type_table_impl(type_table) if @type.nil? raise 'Recursive type uninitialized' else if !get_type.is_a?(PrimitiveType) type_table.add(self, '') @type.build_type_table(type_table) type_table.merge(self, @type.name) end end end
covariant(x)
click to toggle source
# File lib/ic_agent/candid.rb, line 1039 def covariant(x) return false if @type.nil? @type.covariant(x) end
decode_value(b, t)
click to toggle source
# File lib/ic_agent/candid.rb, line 1073 def decode_value(b, t) if @type.nil? raise 'Recursive type uninitialized' else @type.decode_value(b, t) end end
display()
click to toggle source
# File lib/ic_agent/candid.rb, line 1085 def display if @type.nil? raise 'Recursive type uninitialized' else "#{name}.#{@type.name}" end end
encode_type(type_table)
click to toggle source
Calls superclass method
IcAgent::Candid::ConstructType#encode_type
# File lib/ic_agent/candid.rb, line 1053 def encode_type(type_table) if @type.is_a?(PrimitiveType) @type.encode_type(type_table) else super.encode_type(type_table) end end
encode_value(val)
click to toggle source
# File lib/ic_agent/candid.rb, line 1045 def encode_value(val) if @type.nil? raise 'Recursive type uninitialized' else @type.encode_value(val) end end
fill(t)
click to toggle source
# File lib/ic_agent/candid.rb, line 1027 def fill(t) @type = t end
get_type()
click to toggle source
# File lib/ic_agent/candid.rb, line 1031 def get_type if @type.is_a?(RecClass) @type.get_type else @type end end
name()
click to toggle source
# File lib/ic_agent/candid.rb, line 1081 def name "rec_#{@id}" end