Class: TestML::Num

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

Overview


Instance Attribute Summary

Attributes inherited from Object

#value

Instance Method Summary collapse

Methods inherited from Object

#initialize, #none, #type

Constructor Details

This class inherits a constructor from TestML::Object

Instance Method Details

#boolObject



434
435
436
# File 'lib/testml/runtime.rb', line 434

def bool
  @value != 0 ? TestML::Constant::True : TestML::Constant::False
end

#listObject



437
438
439
440
# File 'lib/testml/runtime.rb', line 437

def list
  list = []
  [1..(@value-1)].each { |i| list[i - 1] = nil }
end

#numObject



431
432
433
# File 'lib/testml/runtime.rb', line 431

def num
  self
end

#strObject



428
429
430
# File 'lib/testml/runtime.rb', line 428

def str
  TestML::Str.new(@value.to_s)
end