class Lisp::Boolean

Public Class Methods

FALSE() click to toggle source
# File lib/rubylisp/boolean.rb, line 8
def self.FALSE
  @false_constant ||= Lisp::Boolean.new(false)
end
TRUE() click to toggle source
# File lib/rubylisp/boolean.rb, line 4
def self.TRUE
  @true_constant ||= Lisp::Boolean.new(true)
end
new(b) click to toggle source
# File lib/rubylisp/boolean.rb, line 16
def initialize(b)
  @value = b
end
with_value(b) click to toggle source
# File lib/rubylisp/boolean.rb, line 12
def self.with_value(b)
  b ? self.TRUE : self.FALSE
end

Public Instance Methods

boolean?() click to toggle source
# File lib/rubylisp/boolean.rb, line 24
def boolean?
  true
end
false?() click to toggle source
# File lib/rubylisp/boolean.rb, line 40
def false?
  !@value
end
negate() click to toggle source
# File lib/rubylisp/boolean.rb, line 44
def negate
  Lisp::Boolean.with_value(!@value)
end
to_s() click to toggle source
# File lib/rubylisp/boolean.rb, line 28
def to_s
  if @value
    "#t"
  else
    "#f"
  end
end
true?() click to toggle source
# File lib/rubylisp/boolean.rb, line 36
def true?
  @value
end
type() click to toggle source
# File lib/rubylisp/boolean.rb, line 20
def type
  :boolean
end