Sha256: a80ed204638252cb2f10a1655c5dc7ae86d9ecc5bdff4ef3ba66a93c17b82e8b

Contents?: true

Size: 598 Bytes

Versions: 28

Compression:

Stored size: 598 Bytes

Contents

module Deface
  module Actions
    class AddToAttributes < AttributeAction
      def execute_for_attribute(target_element, name, value)
        if target_element.attributes.key?(name)
          target_element.set_attribute(name, target_element.attributes[name].value << " #{value}")
        elsif target_element.attributes.key?("data-erb-#{name}")
          target_element.set_attribute("data-erb-#{name}", target_element.attributes["data-erb-#{name}"].value << " #{value}")
        else
          target_element.set_attribute("data-erb-#{name}", value.to_s)
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
deface-1.9.0 lib/deface/actions/add_to_attributes.rb
deface-1.8.2 lib/deface/actions/add_to_attributes.rb
deface-1.8.1 lib/deface/actions/add_to_attributes.rb
deface-1.8.0 lib/deface/actions/add_to_attributes.rb
deface-1.7.0 lib/deface/actions/add_to_attributes.rb
deface-1.6.2 lib/deface/actions/add_to_attributes.rb
deface-1.6.1 lib/deface/actions/add_to_attributes.rb
deface-1.6.0 lib/deface/actions/add_to_attributes.rb
deface-1.5.3 lib/deface/actions/add_to_attributes.rb
deface-1.5.2 lib/deface/actions/add_to_attributes.rb
deface-1.5.1 lib/deface/actions/add_to_attributes.rb
deface-1.5.0 lib/deface/actions/add_to_attributes.rb
deface-1.4.0 lib/deface/actions/add_to_attributes.rb
deface-1.3.2 lib/deface/actions/add_to_attributes.rb
deface-1.3.1 lib/deface/actions/add_to_attributes.rb
deface-1.3.0 lib/deface/actions/add_to_attributes.rb
deface-1.2.0 lib/deface/actions/add_to_attributes.rb
deface-1.1.0 lib/deface/actions/add_to_attributes.rb
deface-1.0.2 lib/deface/actions/add_to_attributes.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/deface-1.0.1/lib/deface/actions/add_to_attributes.rb