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.
105 106 107 |
# File 'lib/expressive.rb', line 105 def initialize(&block) @block = block end |
Instance Method Details
#call(scope, statements) ⇒ Object
109 110 111 112 |
# File 'lib/expressive.rb', line 109 def call(scope, statements) parameters = statements.map {|c| c.eval(scope)} @block.call(*parameters) end |