Class: Overapp::TemplateFile::BodyMod::List
- Defined in:
- lib/overapp/template_file/body_mod.rb
Instance Method Summary collapse
Instance Method Details
#register(match_proc, transform_proc) ⇒ Object
14 15 16 |
# 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) ⇒ Object
18 19 20 21 22 23 24 |
# 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 |