Method: Function#to_block
- Defined in:
- lib/linmeric/Function_class.rb
#to_block(n = 0) ⇒ Object
Returns the function as a ruby block ({ |…| … })
-
argument: number of variables needed for the block; default value is set if n == 0
-
returns: string that represents the block;
nilif an error is found
35 36 37 38 39 40 41 |
# File 'lib/linmeric/Function_class.rb', line 35 def to_block(n = 0) return nil if not self.ok? return nil if n < @vars.size n = @vars.size if n == 0 b_v = "|#{vars(n)}|" if n > 0 return "{ #{b_v} #{@funct} }" end |