Skip to content

Commit

Permalink
Use ruby/actions/.github/workflows/ruby_versions.yml@master
Browse files Browse the repository at this point in the history
  • Loading branch information
k-tsj committed May 16, 2024
1 parent 4d6de2f commit bdabad5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
on: [ push, pull_request ]

jobs:
ruby-versions:
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
with:
engine: cruby
min_version: 2.4
test:
needs: ruby-versions
name: >-
Test (${{ matrix.ruby-version }} / ${{ matrix.os }} / DISABLE_REFINEMENTS: ${{ matrix.DISABLE_REFINEMENTS }})
strategy:
fail-fast: false
matrix:
ruby-version: [ '3.0', 2.7, 2.6, 2.5, 2.4, head ]
ruby-version: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
os: [ ubuntu-latest, macos-latest ]
exclude:
- { os: macos-latest, ruby-version: 2.4 }
- { os: macos-latest, ruby-version: 2.5 }
DISABLE_REFINEMENTS: [ 1, 0 ]
runs-on: ${{ matrix.os }}
env:
Expand Down
12 changes: 10 additions & 2 deletions lib/pattern-match/deconstructor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ def call(*subpatterns)
end

refine Class do
include PatternMatch::Deconstructable
if respond_to?(:import_methods, true)
import_methods PatternMatch::Deconstructable
else
include PatternMatch::Deconstructable
end

def deconstruct(val)
raise NotImplementedError, "need to define `#{__method__}'"
Expand Down Expand Up @@ -69,7 +73,11 @@ def deconstruct(val)
end

refine Regexp do
include PatternMatch::Deconstructable
if respond_to?(:import_methods, true)
import_methods PatternMatch::Deconstructable
else
include PatternMatch::Deconstructable
end

def deconstruct(val)
m = Regexp.new("\\A#{source}\\z", options).match(val.to_s)
Expand Down
6 changes: 6 additions & 0 deletions lib/pattern-match/experimental.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ def call(*subpatterns)
end
end

refine Class do
if respond_to?(:import_methods, true)
import_methods PatternMatch::Deconstructable
end
end

module AttributeMatcher
def self.included(klass)
class << klass
Expand Down

0 comments on commit bdabad5

Please sign in to comment.