diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ce285b..e4a52bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,7 @@ jobs: - 3.1 - 3.2 - 3.3 + - 3.4 env: BUNDLE_GEMFILE: Gemfile name: "RSpec tests: Ruby ${{ matrix.ruby }}" diff --git a/code_ownership.gemspec b/code_ownership.gemspec index 58cd881..e173f8c 100644 --- a/code_ownership.gemspec +++ b/code_ownership.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |spec| spec.name = 'code_ownership' - spec.version = '1.38.1' + spec.version = '1.38.2' spec.authors = ['Gusto Engineers'] spec.email = ['dev@gusto.com'] spec.summary = 'A gem to help engineering teams declare ownership of code' diff --git a/lib/code_ownership.rb b/lib/code_ownership.rb index f3656a7..ba4b348 100644 --- a/lib/code_ownership.rb +++ b/lib/code_ownership.rb @@ -136,13 +136,23 @@ def backtrace_with_ownership(backtrace) # # ./app/controllers/some_controller.rb:43:in `block (3 levels) in create' # - backtrace_line = %r{\A(#{Pathname.pwd}/|\./)? - (?.+) # Matches 'app/controllers/some_controller.rb' - : - (?\d+) # Matches '43' - :in\s - `(?.*)' # Matches "`block (3 levels) in create'" - \z}x + backtrace_line = if RUBY_VERSION >= '3.4.0' + %r{\A(#{Pathname.pwd}/|\./)? + (?.+) # Matches 'app/controllers/some_controller.rb' + : + (?\d+) # Matches '43' + :in\s + '(?.*)' # Matches "`block (3 levels) in create'" + \z}x + else + %r{\A(#{Pathname.pwd}/|\./)? + (?.+) # Matches 'app/controllers/some_controller.rb' + : + (?\d+) # Matches '43' + :in\s + `(?.*)' # Matches "`block (3 levels) in create'" + \z}x + end backtrace.lazy.filter_map do |line| match = line.match(backtrace_line)