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



1358
1359
1360
# File 'lib/ic_agent/candid.rb', line 1358

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

.method_missing(method_name) ⇒ Object



1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
# File 'lib/ic_agent/candid.rb', line 1291

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



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

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

.recObject



1354
1355
1356
# File 'lib/ic_agent/candid.rb', line 1354

def self.rec
  RecClass.new
end

.record(t) ⇒ Object



1346
1347
1348
# File 'lib/ic_agent/candid.rb', line 1346

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

.service(t) ⇒ Object



1362
1363
1364
# File 'lib/ic_agent/candid.rb', line 1362

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

.tuple(*types) ⇒ Object



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

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

.variant(fields) ⇒ Object



1350
1351
1352
# File 'lib/ic_agent/candid.rb', line 1350

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

.vec(t) ⇒ Object



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

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