Class: HtmlSurgeon::ChangeSet
- Inherits:
-
Object
- Object
- HtmlSurgeon::ChangeSet
- Defined in:
- lib/html_surgeon/change_set.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#change_list ⇒ Object
readonly
Returns the value of attribute change_list.
-
#node_set ⇒ Object
readonly
Returns the value of attribute node_set.
-
#run_time ⇒ Object
readonly
Returns the value of attribute run_time.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
- #add_css_class(css_class) ⇒ Object
- #changes ⇒ Object
-
#initialize(node_set, base) ⇒ ChangeSet
constructor
A new instance of ChangeSet.
-
#replace_tag_name(new_tag_name) ⇒ Object
CHANGES.
-
#run ⇒ Object
TODO: #preview, like run but in another doc, does not change it yet.
Constructor Details
#initialize(node_set, base) ⇒ ChangeSet
Returns a new instance of ChangeSet.
6 7 8 9 10 11 12 |
# File 'lib/html_surgeon/change_set.rb', line 6 def initialize(node_set, base) @node_set = node_set @base = base @change_list = [] @uuid = SecureRandom.uuid @run_time = nil end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
4 5 6 |
# File 'lib/html_surgeon/change_set.rb', line 4 def base @base end |
#change_list ⇒ Object (readonly)
Returns the value of attribute change_list.
4 5 6 |
# File 'lib/html_surgeon/change_set.rb', line 4 def change_list @change_list end |
#node_set ⇒ Object (readonly)
Returns the value of attribute node_set.
4 5 6 |
# File 'lib/html_surgeon/change_set.rb', line 4 def node_set @node_set end |
#run_time ⇒ Object (readonly)
Returns the value of attribute run_time.
4 5 6 |
# File 'lib/html_surgeon/change_set.rb', line 4 def run_time @run_time end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
4 5 6 |
# File 'lib/html_surgeon/change_set.rb', line 4 def uuid @uuid end |
Instance Method Details
#add_css_class(css_class) ⇒ Object
39 40 41 42 |
# File 'lib/html_surgeon/change_set.rb', line 39 def add_css_class(css_class) change_list << Changes::AddCssClass.new(change_set: self, css_class: css_class) self end |
#changes ⇒ Object
28 29 30 |
# File 'lib/html_surgeon/change_set.rb', line 28 def changes change_list.map &:log end |
#replace_tag_name(new_tag_name) ⇒ Object
CHANGES
34 35 36 37 |
# File 'lib/html_surgeon/change_set.rb', line 34 def replace_tag_name(new_tag_name) change_list << Changes::ReplaceTagName.new(change_set: self, new_tag_name: new_tag_name) self end |
#run ⇒ Object
TODO: #preview, like run but in another doc, does not change it yet.
18 19 20 21 22 23 24 25 26 |
# File 'lib/html_surgeon/change_set.rb', line 18 def run @run_time = Time.now.utc node_set.each do |element| apply_on_element(element) end self end |