glob 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a7c2fc46f05a01010dc0b3d6541528e3ec339103adcdda5621265cbd10c0b77
4
- data.tar.gz: c335a9778db574f36d1a3c0da2119f42ddec83b91e2d7024b4d265122149e493
3
+ metadata.gz: 6ff5ab685a7e249aa924466ecde163739bbaa39021112375b010682b8f3c19ec
4
+ data.tar.gz: 9bd5d1e109640be5b6dc8b68af7f8158c8eb6bd460dcb84e5e07161cd2e21977
5
5
  SHA512:
6
- metadata.gz: 756f0564e9e192ce4c975bfdfcd299acffceab70f47b4e34c49d3180cc0887e6933a0b87ee3583ac37fadd3401e420b0e43f7e8776f072b8ae91e154b51b3adc
7
- data.tar.gz: ba1fe966b7cfef2f0d8d78e417132ea1b60466b4732002519bd398822115fe8751e7d8525050cee72be3f4375320861240510a2fb75deb4eb3ba7aa7bd605f71
6
+ metadata.gz: c2343bfb510ea2f78ba403fab7d0f4eca8caf2ef0e0a5b40076b17ebeca1e45a1bc61da16b7816bd095ba157dcd2cb83f6696789550c500cd31989c07e98addc
7
+ data.tar.gz: 11704b0cc7e4e0e7107f7c4f24f2c9f3885acde420a993f9b47b2a76865998067aa24c9940a16986f6438b2e12820e39b3fbd393035fe1ff8fd299dafc815b16
@@ -19,20 +19,18 @@ jobs:
19
19
  strategy:
20
20
  fail-fast: false
21
21
  matrix:
22
- ruby: ["3.0", "3.1", "3.2", "3.3"]
22
+ ruby: ["3.4", "3.5", "4.0"]
23
23
  gemfile:
24
24
  - Gemfile
25
25
 
26
26
  steps:
27
- - uses: actions/checkout@v4
27
+ - uses: actions/checkout@v6
28
28
 
29
- - uses: actions/cache@v3
29
+ - uses: actions/cache@v5
30
30
  with:
31
31
  path: vendor/bundle
32
32
  key: >
33
- ${{ runner.os }}-${{ matrix.ruby }}-gems-${{
34
- hashFiles(matrix.gemfile) }}
35
-
33
+ ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles(matrix.gemfile) }}
36
34
  - name: Set up Ruby
37
35
  uses: ruby/setup-ruby@v1
38
36
  with:
data/CHANGELOG.md CHANGED
@@ -11,6 +11,11 @@ Prefix your message with one of the following:
11
11
  - [Security] in case of vulnerabilities.
12
12
  -->
13
13
 
14
+ ## v0.5.0 - 2026-05-31
15
+
16
+ - [Added] Add `Glob::Object#match?`, so you can check things like
17
+ `glob.match?("a.*")`.
18
+
14
19
  ## v0.4.1 - 2024-01-03
15
20
 
16
21
  - [Fixed] Fix partial matching when not using `*`.
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # glob
2
2
 
3
- [![Tests](https://github.com/fnando/glob/workflows/ruby-tests/badge.svg)](https://github.com/fnando/glob)
4
- [![Code Climate](https://codeclimate.com/github/fnando/glob/badges/gpa.svg)](https://codeclimate.com/github/fnando/glob)
3
+ [![ruby-tests](https://github.com/fnando/glob/actions/workflows/ruby-tests.yml/badge.svg)](https://github.com/fnando/glob/actions/workflows/ruby-tests.yml)
5
4
  [![Gem](https://img.shields.io/gem/v/glob.svg)](https://rubygems.org/gems/glob)
6
5
  [![Gem](https://img.shields.io/gem/dt/glob.svg)](https://rubygems.org/gems/glob)
7
6
 
@@ -102,6 +101,12 @@ glob.paths
102
101
 
103
102
  glob.to_h
104
103
  #=> {:formats=>{:".rb"=>"Ruby"}}
104
+
105
+ glob.match?("formats")
106
+ #=> false
107
+
108
+ glob.match?("formats.*")
109
+ #=> true
105
110
  ```
106
111
 
107
112
  You can set new keys by using `.set(path, value)`:
data/lib/glob/object.rb CHANGED
@@ -46,6 +46,13 @@ module Glob
46
46
  .sort
47
47
  end
48
48
 
49
+ def match?(wanted)
50
+ matcher = Matcher.new(wanted)
51
+ list = paths
52
+ list.include?(wanted) || list.any? {|path| matcher.match?(path) }
53
+ end
54
+ alias =~ match?
55
+
49
56
  private def map
50
57
  @map ||= Map.call(@target)
51
58
  end
data/lib/glob/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Glob
4
- VERSION = "0.4.1"
4
+ VERSION = "0.5.0"
5
5
  end
data/test/glob_test.rb CHANGED
@@ -287,4 +287,15 @@ class GlobTest < Minitest::Test
287
287
  assert_equal expected, glob.to_h
288
288
  assert_equal ["a.a1.a2", "b.b1.b2.b3.b4"], glob.paths
289
289
  end
290
+
291
+ test "checks key" do
292
+ glob = Glob.new(a: 1, b: {b1: {b2: 2}})
293
+ glob << "*"
294
+
295
+ assert_match glob, "a"
296
+ refute_match glob, "a.*"
297
+ assert_match glob, "b.*"
298
+ assert_match glob, "b.b1.*"
299
+ assert_match glob, "b.b1.b2"
300
+ end
290
301
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-01-03 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: minitest
@@ -152,11 +151,10 @@ metadata:
152
151
  rubygems_mfa_required: 'true'
153
152
  homepage_uri: https://github.com/fnando/glob
154
153
  bug_tracker_uri: https://github.com/fnando/glob/issues
155
- source_code_uri: https://github.com/fnando/glob/tree/v0.4.1
156
- changelog_uri: https://github.com/fnando/glob/tree/v0.4.1/CHANGELOG.md
157
- documentation_uri: https://github.com/fnando/glob/tree/v0.4.1/README.md
158
- license_uri: https://github.com/fnando/glob/tree/v0.4.1/LICENSE.md
159
- post_install_message:
154
+ source_code_uri: https://github.com/fnando/glob/tree/v0.5.0
155
+ changelog_uri: https://github.com/fnando/glob/tree/v0.5.0/CHANGELOG.md
156
+ documentation_uri: https://github.com/fnando/glob/tree/v0.5.0/README.md
157
+ license_uri: https://github.com/fnando/glob/tree/v0.5.0/LICENSE.md
160
158
  rdoc_options: []
161
159
  require_paths:
162
160
  - lib
@@ -171,8 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
169
  - !ruby/object:Gem::Version
172
170
  version: '0'
173
171
  requirements: []
174
- rubygems_version: 3.4.19
175
- signing_key:
172
+ rubygems_version: 4.0.10
176
173
  specification_version: 4
177
174
  summary: Create a list of hash paths that match a given pattern. You can also generate
178
175
  a hash with only the matching paths.