class Dhall::Natural

Public Class Methods

as_dhall() click to toggle source
# File lib/dhall/ast.rb, line 1122
def self.as_dhall
        Builtins[:Natural]
end

Public Instance Methods

*(other) click to toggle source
Calls superclass method Dhall::Expression#*
# File lib/dhall/ast.rb, line 1139
def *(other)
        other = other.as_dhall
        return self if zero?
        if other.is_a?(Natural)
                with(value: value * other.value)
        else
                super
        end
end
+(other) click to toggle source
Calls superclass method Dhall::Expression#+
# File lib/dhall/ast.rb, line 1130
def +(other)
        other = other.as_dhall
        if other.is_a?(Natural)
                with(value: value + other.value)
        else
                super
        end
end
===(other) click to toggle source
# File lib/dhall/ast.rb, line 1173
def ===(other)
        self == other || value === other
end
as_json() click to toggle source
# File lib/dhall/ast.rb, line 1177
def as_json
        [15, value]
end
coerce(other) click to toggle source
# File lib/dhall/ast.rb, line 1126
def coerce(other)
        [other.as_dhall, self]
end
even?() click to toggle source
# File lib/dhall/ast.rb, line 1157
def even?
        value.even?
end
odd?() click to toggle source
# File lib/dhall/ast.rb, line 1161
def odd?
        value.odd?
end
pred() click to toggle source
# File lib/dhall/ast.rb, line 1169
def pred
        with(value: [0, value - 1].max)
end
to_i() click to toggle source
# File lib/dhall/ast.rb, line 1149
def to_i
        value
end
to_s() click to toggle source
# File lib/dhall/ast.rb, line 1153
def to_s
        value.to_s
end
zero?() click to toggle source
# File lib/dhall/ast.rb, line 1165
def zero?
        value.zero?
end