Class: Sexpr::Processor::SexprCoercions

Inherits:
Helper
  • Object
show all
Defined in:
lib/sexpr/processor/sexpr_coercions.rb

Defined Under Namespace

Modules: Methods

Instance Attribute Summary

Attributes inherited from Helper

#next_in_chain

Instance Method Summary collapse

Methods inherited from Helper

#on_missing

Instance Method Details

#call(processor, sexpr, &bl) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/sexpr/processor/sexpr_coercions.rb', line 17

def call(processor, sexpr, &bl)
  g = processor.class.grammar

  # input coercion
  sexpr = g.sexpr(sexpr)

  # recursive call
  sexpr = next_call(processor, sexpr, bl)

  # output coercion
  if sexpr.is_a?(Array) and sexpr.first.is_a?(Symbol)
    g.sexpr(sexpr)
  else
    sexpr
  end
end