Class: Deface::Actions::RemoveFromAttributes
- Inherits:
-
AttributeAction
- Object
- Action
- AttributeAction
- Deface::Actions::RemoveFromAttributes
- Defined in:
- lib/deface/actions/remove_from_attributes.rb
Instance Attribute Summary
Attributes inherited from AttributeAction
Instance Method Summary collapse
Methods inherited from AttributeAction
Methods inherited from Action
#initialize, #range_compatible?, to_sym
Constructor Details
This class inherits a constructor from Deface::Actions::AttributeAction
Instance Method Details
#execute_for_attribute(target_element, name, value) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/deface/actions/remove_from_attributes.rb', line 4 def execute_for_attribute(target_element, name, value) if target_element.attributes.key?(name) target_element.set_attribute(name, target_element.attributes[name].value.gsub(value.to_s, '').strip) elsif target_element.attributes.key?("data-erb-#{name}") target_element.set_attribute("data-erb-#{name}", target_element.attributes["data-erb-#{name}"].value.gsub(value.to_s, '').strip) end end |