Class: Gemite::Function

Inherits:
Object
  • Object
show all
Defined in:
lib/gemite/function.rb

Overview

def name(params) ... end で定義された関数の実行時表現。 closure_env には定義時点で有効だったEnvironmentを保持し、 関数内から外側(グローバル等)の変数を読み取れるようにする(代入は関数内ローカルに留まる)。

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, params, body, closure_env) ⇒ Function

Returns a new instance of Function.



10
11
12
13
14
15
# File 'lib/gemite/function.rb', line 10

def initialize(name, params, body, closure_env)
  @name = name
  @params = params
  @body = body
  @closure_env = closure_env
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



8
9
10
# File 'lib/gemite/function.rb', line 8

def body
  @body
end

#closure_envObject (readonly)

Returns the value of attribute closure_env.



8
9
10
# File 'lib/gemite/function.rb', line 8

def closure_env
  @closure_env
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/gemite/function.rb', line 8

def name
  @name
end

#paramsObject (readonly)

Returns the value of attribute params.



8
9
10
# File 'lib/gemite/function.rb', line 8

def params
  @params
end

Instance Method Details

#to_sObject



17
18
19
# File 'lib/gemite/function.rb', line 17

def to_s
  "<function #{name}>"
end