Class: Deface::Actions::SetAttributes

Inherits:
AttributeAction show all
Defined in:
lib/deface/actions/set_attributes.rb

Instance Attribute Summary

Attributes inherited from AttributeAction

#attributes

Instance Method Summary collapse

Methods inherited from AttributeAction

#execute, #initialize

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
# File 'lib/deface/actions/set_attributes.rb', line 4

def execute_for_attribute(target_element, name, value)
  target_element.remove_attribute(name)
  target_element.remove_attribute("data-erb-#{name}")

  target_element.set_attribute("data-erb-#{name}", value.to_s)
end