class Expressionist::Function
Attributes
args[R]
name[R]
Public Class Methods
new(name, *args)
click to toggle source
# File lib/expressionist/function.rb, line 9 def initialize(name, *args) if name.kind_of?(Array) && args.length == 0 @name = name[0] @args = name[1..-1].map do |arg| arg.kind_of?(Array) ? Function.new(arg) : arg end else @name = name @args = args end end
Public Instance Methods
==(other)
click to toggle source
# File lib/expressionist/function.rb, line 29 def ==(other) self.class == other.class && other.name == self.name && other.args == self.args end
to_a()
click to toggle source
# File lib/expressionist/function.rb, line 21 def to_a [name] + args.map { |arg| arg.kind_of?(Function) ? arg.to_a : arg } end
to_s()
click to toggle source
# File lib/expressionist/function.rb, line 25 def to_s "#{name}(#{args.map(&to_s).join(', ')})" end