Module: Scmo

Defined in:
lib/scmo/object.rb

Defined Under Namespace

Classes: EmptyList, FalseValue, Object, TrueValue, UndefValue

Constant Summary collapse

EMPTY_LIST =
EmptyList.instance
UNDEF =
UndefValue.instance
FALSE =
FalseValue.instance
TRUE =
TrueValue.instance

Class Method Summary collapse

Class Method Details

.rbo2scmo(rb_obj) ⇒ Object



103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/scmo/object.rb', line 103

def self.rbo2scmo(rb_obj)
  case rb_obj
  when FalseClass
    FALSE
  when TrueClass
    TRUE
  when NilClass
    EMPTY_LIST
  when Array
    rb_obj.empty? ? EMPTY_LIST : List.list(*rb_obj)
  else
    rb_obj
  end
end

.scheme_object?(obj) ⇒ Boolean



99
100
101
# File 'lib/scmo/object.rb', line 99

def self.scheme_object?(obj)
  obj.kind_of?(Object)
end