Class: Lisp::FfiNew

Inherits:
Atom show all
Defined in:
lib/rubylisp/ffi_new.rb

Instance Attribute Summary

Attributes inherited from Atom

#value

Instance Method Summary collapse

Methods inherited from Atom

#all?, #car, #cdr, #character?, #class?, #copy, #doc, #environment?, #eof_object?, #eq?, #equal?, #eqv?, #evaluate, #false?, #frame?, #function?, #length, #lisp_object?, #list?, #macro?, #negative?, #number?, #object?, #pair?, #port?, #positive?, #print_string, #quoted, #set!, #set_location, #special?, #string?, #symbol?, #true?, #vector?, #zero?

Constructor Details

#initialize(name) ⇒ FfiNew

Returns a new instance of FfiNew.



5
6
7
# File 'lib/rubylisp/ffi_new.rb', line 5

def initialize(name)
  @value = name
end

Instance Method Details

#apply_to(args, env) ⇒ Object



9
10
11
12
# File 'lib/rubylisp/ffi_new.rb', line 9

def apply_to(args, env)
  @klass = Object.const_get(@value)
  NativeObject.with_value(@klass.new)
end

#apply_to_without_evaluating(args, env) ⇒ Object



14
15
16
17
# File 'lib/rubylisp/ffi_new.rb', line 14

def apply_to_without_evaluating(args, env)
  @klass = Object.const_get(@value)
  NativeObject.with_value(@klass.new)
end

#primitive?Boolean

Returns:



23
24
25
# File 'lib/rubylisp/ffi_new.rb', line 23

def primitive?
  true
end

#to_sObject



19
20
21
# File 'lib/rubylisp/ffi_new.rb', line 19

def to_s
  "#{@value}."
end

#typeObject



27
28
29
# File 'lib/rubylisp/ffi_new.rb', line 27

def type
  :primitive
end