class Overapp::TemplateFile::BodyMod::List

Public Instance Methods

register(match_proc, transform_proc) click to toggle source
# File lib/overapp/template_file/body_mod.rb, line 14
def register(match_proc, transform_proc)
  self.list << Single.new(match: match_proc, transform: transform_proc)
end
transform(base_body,body,params) click to toggle source
# File lib/overapp/template_file/body_mod.rb, line 18
def transform(base_body,body,params)
  single = list.find { |x| x.match?(params) }
  raise "bad #{params.inspect}" unless single
  res = single.transform[base_body,body,params]
  raise "no change" if res == base_body
  res
end