Class: Deface::Actions::ReplaceContents
Instance Attribute Summary
#source_element
Instance Method Summary
collapse
#initialize
Methods inherited from Action
#initialize, to_sym
Instance Method Details
#execute(target_range) ⇒ Object
4
5
6
7
8
9
10
11
12
|
# File 'lib/deface/actions/replace_contents.rb', line 4
def execute(target_range)
if target_range.length == 1
target_range.first.children.remove
target_range.first.add_child(source_element)
else
target_range[1..-2].map(&:remove)
target_range.first.after(source_element)
end
end
|
#range_compatible? ⇒ Boolean
14
15
16
|
# File 'lib/deface/actions/replace_contents.rb', line 14
def range_compatible?
true
end
|