html_surgeon 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea18a1a38e7092b49deafb968f68919fe15f45e5
4
- data.tar.gz: dcf6fc154ff9e9798bc3d0a673ed8fd2ff55975c
3
+ metadata.gz: baa39a17d913698e40c9bf2a0aa01b2602c79b25
4
+ data.tar.gz: ba53b5ec29bd03823da8f285ed6e4b2da755d19f
5
5
  SHA512:
6
- metadata.gz: 0e7de3d7fba71d1e5d3f778fa8316060c5ec75c778a7a17d2570201d54acd884a5567b08251ac273894160ece98f60906f2683ec83e4879eb39782b585f1fb09
7
- data.tar.gz: 04e7baa3bc0440415dc461cb02c5ab8f7a967d354b86663c517ffbef092f88cd885294beba87e74c56b9b449d703a0a1c7df120a11a5d30da748c954f2bdda74
6
+ metadata.gz: 7286686df9036e954a598cbc59a6820dad71eca8b9ce64ea9e3088447868bf99193a1e2f27a64d880c44f169b7e21a309bf4adfcb43d01ef544ab7802cbc937e
7
+ data.tar.gz: cb951074c45b144d7cda13ea2408b6f970f709741c2fe952a4cf14d8e22d93788897c8117f87876ac5278b689fd1743548c2e4de6f4ea4b406393bc8cac5281f
data/README.md CHANGED
@@ -87,6 +87,14 @@ change_set.changes
87
87
  # ]
88
88
  ```
89
89
 
90
+ You can also review what nodes were changed, or the count of them
91
+ ```ruby
92
+ change_set.run
93
+
94
+ change_set.changed_nodes # => array with nodes changed (without the skipped nodes)
95
+ change_set.changed_nodes_size # => same as change_set.changed_nodes.size
96
+ ```
97
+
90
98
  We can also chain call the changes in a changeset
91
99
 
92
100
  ```ruby
@@ -254,6 +262,10 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/eturin
254
262
  ## CHANGESET
255
263
 
256
264
 
265
+ ### v0.5.2
266
+
267
+ - added `changed_nodes` and `changed_nodes_size` to Change Set
268
+
257
269
  ### v0.5.1
258
270
 
259
271
  - works with `nil` html, performs a `to_s` to the given html on initialization.
@@ -1,7 +1,7 @@
1
1
  module HtmlSurgeon
2
2
 
3
3
  class ChangeSet
4
- attr_reader :node_set, :base, :change_list, :run_time, :refinement_callbacks
4
+ attr_reader :node_set, :base, :change_list, :run_time, :refinement_callbacks, :changed_nodes
5
5
 
6
6
  def self.create(node_set, base)
7
7
  new_class.new node_set, base
@@ -17,6 +17,7 @@ module HtmlSurgeon
17
17
 
18
18
  def initialize(node_set, base)
19
19
  @node_set = node_set
20
+ @changed_nodes = []
20
21
  @base = base
21
22
  @change_list = []
22
23
  @id = SecureRandom.uuid
@@ -26,6 +27,8 @@ module HtmlSurgeon
26
27
 
27
28
  delegate :audit?, :html, to: :base
28
29
 
30
+ delegate :size, to: :changed_nodes, prefix: true
31
+
29
32
  # TODO: #preview, like run but in another doc, does not change it yet.
30
33
 
31
34
  # chainable fluid ID setter
@@ -82,6 +85,7 @@ module HtmlSurgeon
82
85
  end
83
86
 
84
87
  do_apply_on_node(node)
88
+ changed_nodes << node
85
89
  end
86
90
 
87
91
  def do_apply_on_node(node)
@@ -1,3 +1,3 @@
1
1
  module HtmlSurgeon
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html_surgeon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Turiño