Class: Smartdown::Model::Predicate::Function

Inherits:
Struct
  • Object
show all
Defined in:
lib/smartdown/model/predicate/function.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments

Returns:

  • (Object)

    the current value of arguments



4
5
6
# File 'lib/smartdown/model/predicate/function.rb', line 4

def arguments
  @arguments
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



4
5
6
# File 'lib/smartdown/model/predicate/function.rb', line 4

def name
  @name
end

Instance Method Details

#evaluate(state) ⇒ Object



5
6
7
# File 'lib/smartdown/model/predicate/function.rb', line 5

def evaluate(state)
  state.get(name).call(*evaluate_arguments(state))
end

#humanizeObject



9
10
11
# File 'lib/smartdown/model/predicate/function.rb', line 9

def humanize
  "#{name}(#{arguments.join(' ')})"
end