eac_ruby_utils 0.62.1 → 0.63.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 988305393f16d7782424d4d46c3cfa88d805d1a06b813e87027a9f44ea2b5ce3
|
4
|
+
data.tar.gz: c8c55c9c290a618bcf090a9c7d59bd5a51055d91284ca2e8c411fdb6898f3ee0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7c3cdfdef8b47a669ef14010c8a76399e4bd3febe7c860123a36a3b54dabce947ccbb5231031a11ea11540977930f10a6ca03079e8de86a47f7b4f048b4d0dc
|
7
|
+
data.tar.gz: b1ff9b89451e86ce8a76a05dff08b19b21a77c2c129f5390a2a9400b49bc5a9812eb44ec9591a323c5fb8f419d83da8321d4251cbd5ca0d07409277dabf8e82b
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacRubyUtils
|
4
|
+
class RegexpParser
|
5
|
+
attr_reader :pattern, :builder_proc
|
6
|
+
|
7
|
+
def initialize(pattern, &builder_proc)
|
8
|
+
@pattern = pattern
|
9
|
+
@builder_proc = builder_proc
|
10
|
+
end
|
11
|
+
|
12
|
+
def parse(string)
|
13
|
+
internal_parse(string)[1]
|
14
|
+
end
|
15
|
+
|
16
|
+
def parse!(string)
|
17
|
+
match, result = internal_parse(string)
|
18
|
+
return result if match
|
19
|
+
|
20
|
+
raise ::ArgumentError, "String \"#{string}\" does not match pattern \"#{pattern}\""
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def internal_parse(string)
|
26
|
+
m = pattern.match(string)
|
27
|
+
if m
|
28
|
+
[true, builder_proc ? builder_proc.call(m) : m]
|
29
|
+
else
|
30
|
+
[false, nil]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_ruby_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.63.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -100,20 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0.
|
104
|
-
- - ">="
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
version: 0.1.1
|
103
|
+
version: '0.2'
|
107
104
|
type: :development
|
108
105
|
prerelease: false
|
109
106
|
version_requirements: !ruby/object:Gem::Requirement
|
110
107
|
requirements:
|
111
108
|
- - "~>"
|
112
109
|
- !ruby/object:Gem::Version
|
113
|
-
version: '0.
|
114
|
-
- - ">="
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: 0.1.1
|
110
|
+
version: '0.2'
|
117
111
|
description:
|
118
112
|
email:
|
119
113
|
executables: []
|
@@ -241,6 +235,7 @@ files:
|
|
241
235
|
- lib/eac_ruby_utils/patches/pathname/basename_sub.rb
|
242
236
|
- lib/eac_ruby_utils/patches/regexp.rb
|
243
237
|
- lib/eac_ruby_utils/patches/regexp/if_match.rb
|
238
|
+
- lib/eac_ruby_utils/patches/regexp/to_parser.rb
|
244
239
|
- lib/eac_ruby_utils/patches/string.rb
|
245
240
|
- lib/eac_ruby_utils/patches/string/inflector.rb
|
246
241
|
- lib/eac_ruby_utils/patches/time.rb
|
@@ -249,6 +244,7 @@ files:
|
|
249
244
|
- lib/eac_ruby_utils/paths_hash/entry_key_error.rb
|
250
245
|
- lib/eac_ruby_utils/paths_hash/node.rb
|
251
246
|
- lib/eac_ruby_utils/paths_hash/path_search.rb
|
247
|
+
- lib/eac_ruby_utils/regexp_parser.rb
|
252
248
|
- lib/eac_ruby_utils/require_sub.rb
|
253
249
|
- lib/eac_ruby_utils/rspec.rb
|
254
250
|
- lib/eac_ruby_utils/rspec/conditional.rb
|