Skip to content

Commit

Permalink
Add support for old strscan
Browse files Browse the repository at this point in the history
If we support old strscan, users can also use strscan installed as a
default gem.
  • Loading branch information
kou committed May 20, 2024
1 parent 3316f62 commit 3327cfd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/rexml/parsers/baseparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@

module REXML
module Parsers
if StringScanner::Version < "3.0.8"
module StringScannerCaptures
refine StringScanner do
def captures
values_at(*(1...size))
end
end
end
using StringScannerCaptures
end

# = Using the Pull Parser
# <em>This API is experimental, and subject to change.</em>
# parser = PullParser.new( "<a>text<b att='val'/>txet</a>" )
Expand Down
2 changes: 1 addition & 1 deletion rexml.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = '>= 2.5.0'

spec.add_runtime_dependency("strscan", ">= 3.0.9")
spec.add_runtime_dependency("strscan")
end

0 comments on commit 3327cfd

Please sign in to comment.