class Basic101::Functions

Public Class Methods

new(functions = BuiltInFunctions.make) click to toggle source
# File lib/basic101/functions.rb, line 20
def initialize(functions = BuiltInFunctions.make)
  @functions = {}
  functions.each do |function|
    add_function function
  end
end

Public Instance Methods

add_function(function) click to toggle source
# File lib/basic101/functions.rb, line 31
def add_function(function)
  @functions[function.name] = function
end
call(runtime, identifier, argument_values) click to toggle source
# File lib/basic101/functions.rb, line 27
def call(runtime, identifier, argument_values)
  @functions[identifier.to_s].call(runtime, argument_values)
end
has_function?(name) click to toggle source
# File lib/basic101/functions.rb, line 35
def has_function?(name)
  @functions.has_key?(name.to_s)
end