Class: Gemite::Function
- Inherits:
-
Object
- Object
- Gemite::Function
- Defined in:
- lib/gemite/function.rb
Overview
def name(params) ... end で定義された関数の実行時表現。 closure_env には定義時点で有効だったEnvironmentを保持し、 関数内から外側(グローバル等)の変数を読み取れるようにする(代入は関数内ローカルに留まる)。
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#closure_env ⇒ Object
readonly
Returns the value of attribute closure_env.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(name, params, body, closure_env) ⇒ Function
constructor
A new instance of Function.
- #to_s ⇒ Object
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
#body ⇒ Object (readonly)
Returns the value of attribute body.
8 9 10 |
# File 'lib/gemite/function.rb', line 8 def body @body end |
#closure_env ⇒ Object (readonly)
Returns the value of attribute closure_env.
8 9 10 |
# File 'lib/gemite/function.rb', line 8 def closure_env @closure_env end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/gemite/function.rb', line 8 def name @name end |
#params ⇒ Object (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_s ⇒ Object
17 18 19 |
# File 'lib/gemite/function.rb', line 17 def to_s "<function #{name}>" end |