Class: Solid::Parser::MethodCall

Inherits:
Struct
  • Object
show all
Includes:
MethodWhitelist
Defined in:
lib/solid/parser.rb

Constant Summary collapse

BUILTIN_HANDLERS =
{
  :'&&' => ->(left, right) { left && right },
  :'||' => ->(left, right) { left || right },
  :'and' => ->(left, right) { left and right },
  :'or' => ->(left, right) { left or right }
}

Constants included from MethodWhitelist

MethodWhitelist::METHODS_BLACKLIST, MethodWhitelist::METHODS_WHITELIST

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MethodWhitelist

allow, deny, safely_respond_to?

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments

Returns:

  • (Object)

    the current value of arguments



46
47
48
# File 'lib/solid/parser.rb', line 46

def arguments
  @arguments
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



46
47
48
# File 'lib/solid/parser.rb', line 46

def name
  @name
end

#receiverObject

Returns the value of attribute receiver

Returns:

  • (Object)

    the current value of receiver



46
47
48
# File 'lib/solid/parser.rb', line 46

def receiver
  @receiver
end

Instance Method Details

#evaluate(context) ⇒ Object



58
59
60
# File 'lib/solid/parser.rb', line 58

def evaluate(context)
  Solid.to_liquid(pluck(receiver.evaluate(context), name, *arguments.map {|arg| arg.evaluate(context) }), context)
end