Class: Deface::Actions::AttributeAction
- Defined in:
- lib/deface/actions/attribute_action.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
- #execute(target_element) ⇒ Object
-
#initialize(options = {}) ⇒ AttributeAction
constructor
A new instance of AttributeAction.
Methods inherited from Action
Constructor Details
#initialize(options = {}) ⇒ AttributeAction
Returns a new instance of AttributeAction.
6 7 8 9 10 |
# File 'lib/deface/actions/attribute_action.rb', line 6 def initialize( = {}) super @attributes = [:attributes] raise(DefaceError, "No attributes option specified") unless @attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/deface/actions/attribute_action.rb', line 4 def attributes @attributes end |
Instance Method Details
#execute(target_element) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/deface/actions/attribute_action.rb', line 12 def execute(target_element) target_element = target_element.first attributes.each do |name, value| execute_for_attribute(target_element, normalize_attribute_name(name), value) end end |