Skip to content

Commit

Permalink
feat: SaveOptions#inspect shows the names of the set options
Browse files Browse the repository at this point in the history
Closes #2767
  • Loading branch information
flavorjones committed Feb 28, 2023
1 parent 4ba43be commit 8934b5c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Nokogiri follows [Semantic Versioning](https://semver.org/), please see the [REA

### Improved

* `Nokogiri::XML::Node::SaveOptions#inspect` now shows the names of the options set in the bitmask, similar to `ParseOptions`. [[#2767](https://github.com/sparklemotion/nokogiri/issues/2767)]


### Deprecated

### Performance
Expand Down
8 changes: 8 additions & 0 deletions lib/nokogiri/xml/node/save_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ def #{constant.downcase}?
end

alias_method :to_i, :options

def inspect
options = []
self.class.constants.each do |k|
options << k.downcase if send(:"#{k.downcase}?")
end
super.sub(/>$/, " " + options.join(", ") + ">")
end
end
end
end
Expand Down

0 comments on commit 8934b5c

Please sign in to comment.