Module: Estreet::Function
- Included in:
- FunctionDeclaration, FunctionExpression
- Defined in:
- lib/estreet/function.rb
Instance Method Summary collapse
Instance Method Details
#attributes ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/estreet/function.rb', line 11 def attributes # does super work here (i.e. in a module)? super.merge( generator: false, # ES6? expression: false, # ES6? defaults: [], # ES6? rest: nil, # ?? params: @params, body: @body ) end |
#initialize(params, body) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/estreet/function.rb', line 3 def initialize(params, body) # TODO: join multiple blocks in the body, or whatever? # TODO: allow body to be an expression -- ES6 expression closure @params = params.map(&:to_pattern) @body = body.to_block end |