Class: Lilu::Populate
Instance Attribute Summary
Attributes inherited from Action
Instance Method Summary collapse
Methods inherited from Action
Constructor Details
This class inherits a constructor from Lilu::Action
Instance Method Details
#for(method, data, &block) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/lilu.rb', line 60 def for(method,data,&block) return element.collect {|e| self.element = e ; renderer.instance_eval { action.for(method,data,&block) } } if element.is_a?(Hpricot::Elements) element.cache_search = true update_action = Update.new(element,renderer) parent = element.parent element_html = element.to_html data.send(method) do |*objects| update_action.element = element update_action.with(block.call(*objects)) parent.insert_after(Hpricot.make(element.to_html),element) element = Hpricot.make(element_html) end renderer.action = self Hpricot::Elements[element].remove end |