Class: FormulaDSL::FunctionExpression

Inherits:
Object
  • Object
show all
Defined in:
lib/formula_dsl/function_expression.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, *args) ⇒ FunctionExpression

Returns a new instance of FunctionExpression.



6
7
8
9
# File 'lib/formula_dsl/function_expression.rb', line 6

def initialize(name, *args)
  @name = name
  @args = args
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



5
6
7
# File 'lib/formula_dsl/function_expression.rb', line 5

def args
  @args
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/formula_dsl/function_expression.rb', line 5

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



17
18
19
# File 'lib/formula_dsl/function_expression.rb', line 17

def == (other)
  @name == other.name && @args == other.args
end

#applyObject



11
12
13
14
15
# File 'lib/formula_dsl/function_expression.rb', line 11

def apply
  function = FunctionExpressionFactory.new(@name)

  function.call(@args)
end