Class: Plasma::Interpreter::PlasmaCore

Inherits:
Object
  • Object
show all
Defined in:
lib/plasma/include/plasma_core.rb

Class Method Summary collapse

Class Method Details

.plasma(interp) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/plasma/include/plasma_core.rb', line 4

def self.plasma(interp)
  {
    :import => RubyClosure.new('import', interp) do |plasma|
      interp.merge(plasma)
    end,

    :print => RubyClosure.new('print', interp) do |string|
      puts string.to_plasma
    end,

    :eval => RubyClosure.new('eval', interp) do |quote|
      if quote.is_a?(String)
        interp.interpret(quote)
      else
        interp.evaluate(quote)
      end
    end,

    :parse => RubyClosure.new('parse', interp) do |code|
      interp.parse(code)
    end
  }
end