Class: Expressive::Function
- Inherits:
-
Object
- Object
- Expressive::Function
- Defined in:
- lib/expressive.rb
Direct Known Subclasses
Instance Method Summary collapse
- #call(scope, statements) ⇒ Object
-
#initialize(&block) ⇒ Function
constructor
A new instance of Function.
Constructor Details
#initialize(&block) ⇒ Function
Returns a new instance of Function.
90 91 92 |
# File 'lib/expressive.rb', line 90 def initialize(&block) @block = block end |
Instance Method Details
#call(scope, statements) ⇒ Object
94 95 96 97 |
# File 'lib/expressive.rb', line 94 def call(scope, statements) parameters = statements.map {|c| c.eval(scope)} @block.call(*parameters) end |