RFC: Pattern Matching #2360
Replies: 4 comments
-
I imagine this sort of interface being valuable for matching nodes while parsing streams - XPath is clunky for that sort of thing, and SAX is too low-level for most people to want to deal with it. This might give me a reason to dust off my old sax wrapper https://github.com/soulcutter/saxerator |
Beta Was this translation helpful? Give feedback.
-
I've published a PR with an experimental API at #2523, would love feedback on that pull request from anybody with an opinion. |
Beta Was this translation helpful? Give feedback.
-
Just a bump for anyone following. #2523 has received a bit more love and has some pattern matching use cases in the test suite. Would love to hear any feedback anybody has on this. Likely this will land as "experimental" in v1.14.0. |
Beta Was this translation helpful? Give feedback.
-
Looks like this was useful to someone! rails/rails#49003 Will document pattern matching as no-longer-experimental in the next minor release. |
Beta Was this translation helpful? Give feedback.
-
Pattern Matching
If Nokogiri implemented a pattern matching interface for
Nokogiri::XML::Node
andNokogiri::XML::NodeSet
, what should it look like?If you have some code you're using to deconstruct Nokogiri objects, please post a comment pointing us to what you've done, and explain a bit about your use case and why that approach is valuable, if you can.
If you have use cases for which XPath or CSS queries are awkward or slow, please post a comment explaining what you'd like to be able to do.
Resources
@baweaver has been very thoughtful on the topic of general pattern matching support, he's written Pattern Matching Interfaces in Ruby - Google Docs to start a conversation around basic principles of what "good" looks like in a PM interface
He's also suggested something like this at https://twitter.com/keystonelemur/status/1357424192904454145:
Beta Was this translation helpful? Give feedback.
All reactions