Class: TestML::Object

Inherits:
Object
  • Object
show all
Defined in:
lib/testml/runtime.rb

Overview


Direct Known Subclasses

Bool, Error, List, Native, None, Num, Str

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Object

Returns a new instance of Object.



380
381
382
# File 'lib/testml/runtime.rb', line 380

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



378
379
380
# File 'lib/testml/runtime.rb', line 378

def value
  @value
end

Instance Method Details

#boolObject



396
397
398
# File 'lib/testml/runtime.rb', line 396

def bool
  fail "Cast from #{type} to Bool is not supported"
end

#listObject



399
400
401
# File 'lib/testml/runtime.rb', line 399

def list
  fail "Cast from #{type} to List is not supported"
end

#noneObject



402
403
404
# File 'lib/testml/runtime.rb', line 402

def none
  TestML::Constant::None
end

#numObject



393
394
395
# File 'lib/testml/runtime.rb', line 393

def num
  fail "Cast from #{type} to Num is not supported"
end

#strObject



390
391
392
# File 'lib/testml/runtime.rb', line 390

def str
  fail "Cast from #{type} to Str is not supported"
end

#typeObject



384
385
386
387
388
# File 'lib/testml/runtime.rb', line 384

def type
  type = self.class.to_s
  type.sub! /^TestML::/, '' or fail "Can't find type of '#{type}'"
  return type
end