Class: Crisp::FunctionRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/crisp/function_runner.rb

Overview

The FunctionRunner can eval function calls by instance_eval the function block

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env, args, name) ⇒ FunctionRunner

save name, environment and arguments on creation



13
14
15
16
17
# File 'lib/crisp/function_runner.rb', line 13

def initialize(env, args, name)
  @name = name
  @env = env
  @args = args
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



4
5
6
# File 'lib/crisp/function_runner.rb', line 4

def args
  @args
end

#envObject (readonly)

Returns the value of attribute env.



4
5
6
# File 'lib/crisp/function_runner.rb', line 4

def env
  @env
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/crisp/function_runner.rb', line 4

def name
  @name
end

Class Method Details

.run(blk, env, args, name) ⇒ Object

run the blk



7
8
9
10
# File 'lib/crisp/function_runner.rb', line 7

def self.run(blk, env, args, name)
  runner = new(env, args, name)
  runner.instance_eval(&blk)
end