Class: Deface::Actions::Surround
- Inherits:
-
SurroundAction
- Object
- Action
- ElementAction
- SurroundAction
- Deface::Actions::Surround
- Defined in:
- lib/deface/actions/surround.rb
Instance Attribute Summary
Attributes inherited from ElementAction
Instance Method Summary collapse
Methods inherited from SurroundAction
#original_placeholders, #source_element
Methods inherited from ElementAction
Methods inherited from Action
Constructor Details
This class inherits a constructor from Deface::Actions::ElementAction
Instance Method Details
#execute(target_range) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/deface/actions/surround.rb', line 4 def execute(target_range) original_placeholders.each do |placeholder| start = target_range[0].clone(1) placeholder.replace start target_range[1..-1].each do |element| element = element.clone(1) start.after element start = element end end target_range.first.before(source_element) target_range.map(&:remove) end |
#range_compatible? ⇒ Boolean
19 20 21 |
# File 'lib/deface/actions/surround.rb', line 19 def range_compatible? true end |