A summary of data about the Ruby ecosystem.

https://github.com/teamcapybara/xpath

Ruby library for generating XPath expressions
https://github.com/teamcapybara/xpath

Keywords from Contributors

activerecord mvc activejob rubygems rspec cucumber polyglot-release tidelift mongodb-driver ruby-gem

Last synced: about 9 hours ago
JSON representation

Repository metadata

Ruby library for generating XPath expressions

README.md

XPath

XPath is a Ruby DSL around a subset of XPath 1.0. Its primary purpose is to
facilitate writing complex XPath queries from Ruby code.

Gem Version
Build Status

Generating expressions

To create quick, one-off expressions, XPath.generate can be used:

XPath.generate { |x| x.descendant(:ul)[x.attr(:id) == 'foo'] }

You can also call expression methods directly on the XPath module:

XPath.descendant(:ul)[XPath.attr(:id) == 'foo']

However for more complex expressions, it is probably more convenient to include
the XPath module into your own class or module:

module MyXPaths
  include XPath

  def foo_ul
    descendant(:ul)[attr(:id) == 'foo']
  end

  def password_field(id)
    descendant(:input)[attr(:type) == 'password'][attr(:id) == id]
  end
end

Both ways return an XPath::Expression instance, which can be further
modified. To convert the expression to a string, just call #to_s on it. All
available expressions are defined in XPath::DSL.

String, Hashes and Symbols

When you send a string as an argument to any XPath function, XPath assumes this
to be a string literal. On the other hand if you send in Symbol, XPath assumes
this to be an XPath literal. Thus the following two statements are not
equivalent:

XPath.descendant(:p)[XPath.attr(:id) == 'foo']
XPath.descendant(:p)[XPath.attr(:id) == :foo]

These are the XPath expressions that these would be translated to:

.//p[@id = 'foo']
.//p[@id = foo]

The second expression would match any p tag whose id attribute matches a 'foo'
tag it contains. Most likely this is not what you want.

In fact anything other than a String is treated as a literal. Thus the
following works as expected:

XPath.descendant(:p)[1]

Keep in mind that XPath is 1-indexed and not 0-indexed like most other
programming languages, including Ruby.

License

See LICENSE.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 7 days ago

Total Commits: 214
Total Committers: 32
Avg Commits per committer: 6.688
Development Distribution Score (DDS): 0.369

Commits in past year: 13
Committers in past year: 4
Avg Commits per committer in past year: 3.25
Development Distribution Score (DDS) in past year: 0.385

Name Email Commits
Jonas Nicklas j****s@g****m 135
Thomas Walpole t****e@g****m 16
Your Name n****e@e****e 8
Josef Šimánek j****k@g****m 8
Eric Pierce w****8@g****m 5
Anders Törnqvist a****s@e****e 3
Nicklas Ramhöj d****s@e****e 3
Peter Haza p****a@g****m 3
Steve Valaitis s****e@d****m 3
John Firebaugh j****h@b****m 2
Andrey Botalov b****y@g****m 2
Jun Aruga j****a@r****m 2
Kouhei Sutou k****u@c****m 2
Piotr Jakubowski p****j@g****m 2
Robert Pankowecki r****i@g****m 2
Wes Morgan c****n@g****m 2
enomotodev e****v@g****m 1
dependabot[bot] 4****] 1
compliance-bot 7****t 1
Tom Richards t****m@t****t 1
Anders Törnqvist and Kim Burgestrand d****d@e****e 1
Ivan Navarrete and Jonas Nicklas d****s@e****e 1
Javier Martín e****o@e****t 1
Matt Patterson m****t@r****g 1
Mani Tadayon t****i@m****m 1
Leon Miller-Out l****n@s****m 1
John Barker j****r@g****m 1
Jo Liss j****2@g****m 1
Jared Beck j****d@j****m 1
François VANTOMME a****m@g****m 1
and 2 more...

Committer domains:


Issue and Pull Request metadata

Last synced: about 1 month ago

Total issues: 26
Total pull requests: 84
Average time to close issues: 9 months
Average time to close pull requests: 5 months
Total issue authors: 26
Total pull request authors: 49
Average comments per issue: 2.27
Average comments per pull request: 1.26
Merged pull request: 45
Bot issues: 0
Bot pull requests: 2

Past year issues: 0
Past year pull requests: 10
Past year average time to close issues: N/A
Past year average time to close pull requests: 27 days
Past year issue authors: 0
Past year pull request authors: 3
Past year average comments per issue: 0
Past year average comments per pull request: 0.1
Past year merged pull request: 5
Past year bot issues: 0
Past year bot pull requests: 2

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/teamcapybara/xpath

Top Issue Authors

  • dmitriy-kiriyenko (1)
  • nidalaa (1)
  • Ajedi32 (1)
  • hyandell (1)
  • boeboe (1)
  • steve9001 (1)
  • fidothe (1)
  • cap10morgan (1)
  • wapcaplet (1)
  • jnicklas (1)
  • skorth (1)
  • ches (1)
  • Tails (1)
  • ejholmes (1)
  • abotalov (1)

Top Pull Request Authors

  • twalpole (10)
  • jnicklas (8)
  • simi (7)
  • jfirebaugh (3)
  • abotalov (3)
  • akarzim (3)
  • wapcaplet (3)
  • dnd (2)
  • phaza (2)
  • dependabot[bot] (2)
  • junaruga (2)
  • jarl-dk (2)
  • enomotodev (1)
  • dirksierd (1)
  • wesgibbs (1)

Top Issue Labels

Top Pull Request Labels

  • dependencies (2)
  • ruby (2)

Package metadata

gem.coop: xpath

XPath is a Ruby DSL for generating XPath expressions

  • Homepage: https://github.com/teamcapybara/xpath
  • Documentation: http://www.rubydoc.info/gems/xpath/
  • Licenses: MIT
  • Latest release: 3.2.0 (published about 7 years ago)
  • Last Synced: 2025-12-04T05:02:35.253Z (8 days ago)
  • Versions: 13
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 300,938,497 Total
  • Docker Downloads: 934,326,456
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.044%
    • Downloads: 0.079%
    • Docker downloads count: 0.097%
  • Maintainers (2)
rubygems.org: xpath

XPath is a Ruby DSL for generating XPath expressions

  • Homepage: https://github.com/teamcapybara/xpath
  • Documentation: http://www.rubydoc.info/gems/xpath/
  • Licenses: MIT
  • Latest release: 3.2.0 (published about 7 years ago)
  • Last Synced: 2025-12-04T17:21:31.701Z (7 days ago)
  • Versions: 13
  • Dependent Packages: 19
  • Dependent Repositories: 380,872
  • Downloads: 301,021,946 Total
  • Docker Downloads: 934,326,456
  • Rankings:
    • Dependent repos count: 0.049%
    • Downloads: 0.084%
    • Docker downloads count: 0.168%
    • Dependent packages count: 1.133%
    • Average: 1.628%
    • Forks count: 3.423%
    • Stargazers count: 4.91%
  • Maintainers (2)
proxy.golang.org: github.com/teamcapybara/xpath

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/teamcapybara/xpath#section-documentation
  • Licenses: mit
  • Latest release: v3.0.0+incompatible (published almost 8 years ago)
  • Last Synced: 2025-12-04T17:21:31.188Z (7 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Forks count: 3.197%
    • Stargazers count: 4.257%
    • Average: 6.948%
    • Dependent packages count: 9.56%
    • Dependent repos count: 10.779%

Dependencies

xpath.gemspec rubygems
  • pry >= 0 development
  • rake >= 0 development
  • rspec ~> 3.0 development
  • yard >= 0.5.8 development
  • nokogiri ~> 1.8
.github/workflows/build.yml actions
  • actions/checkout v4 composite
  • ruby/setup-ruby v1 composite
Gemfile rubygems
Gemfile.lock rubygems
  • ast 2.4.3
  • bundler 2.6.8
  • coderay 1.1.3
  • diff-lcs 1.6.1
  • ffi 1.17.1
  • json 2.10.2
  • language_server-protocol 3.17.0.4
  • lint_roller 1.1.0
  • method_source 1.1.0
  • nokogiri 1.18.8
  • parallel 1.26.3
  • parser 3.3.7.4
  • prism 1.4.0
  • pry 0.15.2
  • racc 1.8.1
  • rainbow 3.1.1
  • rake 13.2.1
  • regexp_parser 2.10.0
  • rspec 3.13.0
  • rspec-core 3.13.3
  • rspec-expectations 3.13.3
  • rspec-mocks 3.13.2
  • rspec-support 3.13.2
  • rubocop 1.75.1
  • rubocop-ast 1.43.0
  • rubocop-performance 1.25.0
  • rubocop-rspec 3.5.0
  • ruby-progressbar 1.13.0
  • spoon 0.0.6
  • unicode-display_width 3.1.4
  • unicode-emoji 4.0.4
  • xpath 3.2.0
  • yard 0.9.37

Score: 29.9839723429296