enum

StackMachine::Operation

Inherits Enum < Comparable < Value < Object

Enum for every binary mathematical operaiton. TODO: Figure out a scheme for unary operations.

Constants

Add = 0
Sub = 1
Mul = 2
Div = 3

Instance methods

add?

Returns true if this enum value equals Add

Source
call(l : Float64, r : Float64) : Float64

This method performs the mathematical operation represented by the enum. It will always return an Int32 and truncate on division.

StackMachine::Operation::Add.call(1, 2) # => 3
StackMachine::Operation::Div.call(1, 2) # => 0
Source
div?

Returns true if this enum value equals Div

Source
mul?

Returns true if this enum value equals Mul

Source
sub?

Returns true if this enum value equals Sub

Source