Class: IcAgent::Candid::BaseTypes

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

Class Method Summary collapse

Class Method Details

.func(args, ret, annotations) ⇒ Object



1338
1339
1340
# File 'lib/ic_agent/candid.rb', line 1338

def self.func(args, ret, annotations)
  FuncClass.new(args, ret, annotations)
end

.method_missing(method_name) ⇒ Object



1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
# File 'lib/ic_agent/candid.rb', line 1271

def self.method_missing(method_name)
  case method_name.to_s
  when 'null'
    return NullClass.new
  when 'empty'
    return EmptyClass.new
  when 'bool'
    return BoolClass.new
  when 'int'
    return IntClass.new
  when 'reserved'
    return ReservedClass.new
  when 'nat'
    return NatClass.new
  when 'text'
    return TextClass.new
  when 'principal'
    return PrincipalClass.new
  when 'float32'
    return FloatClass.new(32)
  when 'float64'
    return FloatClass.new(64)
  when 'int8'
    return FixedIntClass.new(8)
  when 'int16'
    return FixedIntClass.new(16)
  when 'int32'
    return FixedIntClass.new(32)
  when 'int64'
    return FixedIntClass.new(64)
  when 'nat8'
    return FixedNatClass.new(8)
  when 'nat16'
    return FixedNatClass.new(16)
  when 'nat32'
    return FixedNatClass.new(32)
  when 'nat64'
    return FixedNatClass.new(64)
  else
    puts "Method #{method_name} is not defined"
  end
end

.opt(t) ⇒ Object



1322
1323
1324
# File 'lib/ic_agent/candid.rb', line 1322

def self.opt(t)
  OptClass.new(t)
end

.recObject



1334
1335
1336
# File 'lib/ic_agent/candid.rb', line 1334

def self.rec
  RecClass.new
end

.record(t) ⇒ Object



1326
1327
1328
# File 'lib/ic_agent/candid.rb', line 1326

def self.record(t)
  RecordClass.new(t)
end

.service(t) ⇒ Object



1342
1343
1344
# File 'lib/ic_agent/candid.rb', line 1342

def self.service(t)
  ServiceClass.new(t)
end

.tuple(*types) ⇒ Object



1314
1315
1316
# File 'lib/ic_agent/candid.rb', line 1314

def self.tuple(*types)
  TupleClass.new(*types)
end

.variant(fields) ⇒ Object



1330
1331
1332
# File 'lib/ic_agent/candid.rb', line 1330

def self.variant(fields)
  VariantClass.new(fields)
end

.vec(t) ⇒ Object



1318
1319
1320
# File 'lib/ic_agent/candid.rb', line 1318

def self.vec(t)
  VecClass.new(t)
end