Class: Rjq::AST::FunctionDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/rjq/ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, params, body, closure = nil) ⇒ FunctionDefinition

Returns a new instance of FunctionDefinition.



129
130
131
132
133
134
# File 'lib/rjq/ast.rb', line 129

def initialize(name, params, body, closure = nil)
  @name = name
  @params = params
  @body = body
  @closure = closure
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



127
128
129
# File 'lib/rjq/ast.rb', line 127

def body
  @body
end

#closureObject (readonly)

Returns the value of attribute closure.



127
128
129
# File 'lib/rjq/ast.rb', line 127

def closure
  @closure
end

#nameObject (readonly)

Returns the value of attribute name.



127
128
129
# File 'lib/rjq/ast.rb', line 127

def name
  @name
end

#paramsObject (readonly)

Returns the value of attribute params.



127
128
129
# File 'lib/rjq/ast.rb', line 127

def params
  @params
end

Instance Method Details

#with_closure(functions) ⇒ Object



136
137
138
# File 'lib/rjq/ast.rb', line 136

def with_closure(functions)
  self.class.new(name, params, body, functions)
end