config_templates 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/config_templates/criteria/name.rb +12 -4
- data/lib/config_templates/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d752207f0865213d7b12f3ba1eb62f4aecce85f0
|
4
|
+
data.tar.gz: c11f18272a97dda4448a9f4d17d11bec99c092f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a67cecc7b557d6eaee4ec4ec8d0f8e05063add3737c7704b559cefb100de4dc764b0ddf5f61be842ce1953e323448ac109dd98533eed4ecd4263eb66e953de5
|
7
|
+
data.tar.gz: 224d4ab9679466750e581474729b5473ffd0b84c18ddb23ff1324b819684557a0edae86e08f054773d1b14bbc7c741d16849623eeb95a0313400be911adf1f77
|
@@ -1,12 +1,20 @@
|
|
1
1
|
module ConfigTemplates::Criteria
|
2
2
|
class Name
|
3
|
-
def initialize(pattern,
|
3
|
+
def initialize(pattern, straight = true)
|
4
4
|
@pattern = pattern
|
5
|
-
@
|
5
|
+
@straight = straight
|
6
6
|
end
|
7
7
|
|
8
|
-
def matches?(
|
9
|
-
@pattern.match?(
|
8
|
+
def matches?(expression)
|
9
|
+
@pattern.match?(cast expression) && @straight
|
10
|
+
end
|
11
|
+
|
12
|
+
def cast(expression)
|
13
|
+
if expression.is_a?(::String) || expression.is_a?(::Regexp)
|
14
|
+
expression
|
15
|
+
else
|
16
|
+
expression.to_s
|
17
|
+
end
|
10
18
|
end
|
11
19
|
end
|
12
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: config_templates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- g.ivanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|