Class: Amrita2::Filters::Trace

Inherits:
Base show all
Defined in:
lib/amrita2/template.rb

Constant Summary collapse

SEP =
"\n" + "-" * 80 + "\n"

Instance Attribute Summary

Attributes inherited from Base

#next_

Instance Method Summary collapse

Methods inherited from Base

filter_method, inherited, #parse_filter_a, #|

Instance Method Details

#filter_element(de, element) ⇒ Object



2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
# File 'lib/amrita2/template.rb', line 2477

def filter_element(de, element)
  if de.tracer
    old_s = element.to_s
    new_element = super
    new_s = new_element.to_s
    if old_s != new_s
      de.tracer << SEP << "before filter:\n" <<
        old_s << SEP << "after filter :\n" << new_s <<  SEP
    end
    new_element
  else
    super
  end
end

#method_body_code(de, cg) ⇒ Object



2498
2499
2500
2501
2502
# File 'lib/amrita2/template.rb', line 2498

def method_body_code(de, cg)
  super
  s = de.element.stag.output("")
  cg.code(%[Tracer << "%s:%s:%s" % [#{s.inspect},"out", __stream__] ])
end

#value_filter_code(de, cg, value) ⇒ Object



2492
2493
2494
2495
2496
# File 'lib/amrita2/template.rb', line 2492

def value_filter_code(de, cg, value)
  s = de.element.stag.output("")
  cg.code(%[Tracer << "%s:%s:%s" % [#{s.inspect},"in", $_.inspect] ])
  super
end