Class: HtmlSurgeon::Change

Inherits:
Object
  • Object
show all
Defined in:
lib/html_surgeon/change.rb

Constant Summary collapse

DATA_CHANGE_AUDIT_ATTRIBUTE =
'data-surgeon-audit'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(change_set:) ⇒ Change

Returns a new instance of Change.



8
9
10
# File 'lib/html_surgeon/change.rb', line 8

def initialize(change_set:)
  @change_set = change_set
end

Instance Attribute Details

#change_setObject (readonly)

Returns the value of attribute change_set.



6
7
8
# File 'lib/html_surgeon/change.rb', line 6

def change_set
  @change_set
end

Instance Method Details

#apply(element) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/html_surgeon/change.rb', line 15

def apply(element)
  prepare_audit_change(element) if audit?

  apply_in element

  apply_audit_change(element) if audit?

  self
end

#logObject



25
26
27
# File 'lib/html_surgeon/change.rb', line 25

def log
  raise AbstractMethodError, "a lazy developer has not implemented this method in #{self.class}"
end