Class: EsiAttributeLanguage::Node

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

Direct Known Subclasses

ConcatNode, DummyNode, HashLookupNode, MethodNode, OrNode

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.cleanse_string(string) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/esi_attribute_language.rb', line 16

def self.cleanse_string(string)
  if string[0] == ?' && string[-1] == ?'
    string[1, string.size - 2].gsub('\\\'', '\'')
  else
    string
  end
end

Instance Method Details

#result(var, context) ⇒ Object



28
29
30
# File 'lib/esi_attribute_language.rb', line 28

def result(var, context)
  var.is_a?(Array) ? var.map{|v| result_single(v, context)} : result_single(var, context)
end

#result_single(var, context) ⇒ Object



24
25
26
# File 'lib/esi_attribute_language.rb', line 24

def result_single(var, context)
  var.respond_to?(:execute) ? var.execute(context) : var
end