Sha256: 9b64e3853ca2799e7bc6fe6281f396f6d3a2fe162b2770f21464f3b1119a1772

Contents?: true

Size: 440 Bytes

Versions: 28

Compression:

Stored size: 440 Bytes

Contents

module Deface
  module Actions
    class ReplaceContents < ElementAction
      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

      def range_compatible?
        true
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
solidus_backend-1.0.0.pre2 vendor/bundle/gems/deface-1.0.1/lib/deface/actions/replace_contents.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/deface-1.0.1/lib/deface/actions/replace_contents.rb
deface-1.0.1 lib/deface/actions/replace_contents.rb
deface-1.0.0 lib/deface/actions/replace_contents.rb
deface-1.0.0.rc4 lib/deface/actions/replace_contents.rb
deface-1.0.0.rc3 lib/deface/actions/replace_contents.rb
deface-1.0.0.rc2 lib/deface/actions/replace_contents.rb
deface-1.0.0.rc1 lib/deface/actions/replace_contents.rb