trick_bag 0.53.0 → 0.54.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/RELEASE_NOTES.md +5 -0
- data/lib/trick_bag/parsers/yaml_tools.rb +18 -0
- data/lib/trick_bag/validations/regex_validations.rb +16 -0
- data/lib/trick_bag/version.rb +1 -1
- data/spec/trick_bag/parsers/yaml_tools_spec.rb +29 -0
- data/spec/trick_bag/validations/regex_validations_spec.rb +7 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d62bc40904819a24cfc0df1d35bf2d4768d3afc2
|
4
|
+
data.tar.gz: fc884dd0178ad83f52faa4f3b0c91880919627e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d418fadc525fb1043de89acc6642d53d4751ef42433d5d3c1eee724e0e60568f508b344677bec2851ffd000795b5f267cf21975d1222afade9d074b57dd028d
|
7
|
+
data.tar.gz: 0fdd71bc5394ad8b67ab6dcfd9f1d6481cb5d99b30c21374a31035f0452323ba1a2a4ce53ba596e330ef06a3aef9652585d218656897b2a8880cd21e249cc5dc
|
data/RELEASE_NOTES.md
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module TrickBag
|
4
|
+
|
5
|
+
module YamlTools
|
6
|
+
|
7
|
+
module_function
|
8
|
+
|
9
|
+
def string_to_mult_objects(string)
|
10
|
+
string_records = string.split(/^---$/)
|
11
|
+
string_records.map { |r| YAML.parse(r) }
|
12
|
+
end
|
13
|
+
|
14
|
+
def file_to_mult_objects(filespec)
|
15
|
+
string_to_mult_objects(File.read(filespec))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -69,6 +69,22 @@ module Validations
|
|
69
69
|
def regexes_with_matches
|
70
70
|
regex_strings_hash.keys.reject { |key| regex_strings_hash[key].empty? }
|
71
71
|
end
|
72
|
+
|
73
|
+
|
74
|
+
# Takes a match hash returned by the match_hash method above,
|
75
|
+
# and returns string representations of the regexes
|
76
|
+
# for which no matches were found.
|
77
|
+
def regexes_without_matches_as_strings
|
78
|
+
regexes_without_matches.map(&:inspect)
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
# Takes a match hash returned by the match_hash method above,
|
83
|
+
# and returns string representations of the regexes
|
84
|
+
# for which matches were found.
|
85
|
+
def regexes_with_matches_as_strings
|
86
|
+
regexes_with_matches.map(&:inspect)
|
87
|
+
end
|
72
88
|
end
|
73
89
|
|
74
90
|
end
|
data/lib/trick_bag/version.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
require 'trick_bag/parsers/yaml_tools'
|
4
|
+
|
5
|
+
module TrickBag
|
6
|
+
module Parsers
|
7
|
+
|
8
|
+
let(objects) { [
|
9
|
+
[1, 2, 3],
|
10
|
+
{ 'fruit' => 'mango', 'color' => 'orange' },
|
11
|
+
42,
|
12
|
+
'foo'
|
13
|
+
]}
|
14
|
+
|
15
|
+
let(yaml_string) { objects.to_yaml }
|
16
|
+
|
17
|
+
describe 'Parsers' do
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
@@ -72,6 +72,13 @@ module TrickBag
|
|
72
72
|
expect(subject.regexes_with_matches).to eq([/a/, /m/])
|
73
73
|
end
|
74
74
|
|
75
|
+
it 'should return the correct array of matches as strings' do
|
76
|
+
expect(subject.regexes_with_matches_as_strings).to eq(%w(/a/ /m/))
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should return the correct array of NONmatches as strings' do
|
80
|
+
expect(subject.regexes_without_matches_as_strings).to eq(%w(/z/))
|
81
|
+
end
|
75
82
|
end
|
76
83
|
end
|
77
84
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trick_bag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.54.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Bennett
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: os
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- lib/trick_bag/numeric/start_and_max.rb
|
114
114
|
- lib/trick_bag/numeric/totals.rb
|
115
115
|
- lib/trick_bag/operators/operators.rb
|
116
|
+
- lib/trick_bag/parsers/yaml_tools.rb
|
116
117
|
- lib/trick_bag/system.rb
|
117
118
|
- lib/trick_bag/timing/timing.rb
|
118
119
|
- lib/trick_bag/validations/gem_dependency_script.rb
|
@@ -140,6 +141,7 @@ files:
|
|
140
141
|
- spec/trick_bag/numeric/start_and_max_spec.rb
|
141
142
|
- spec/trick_bag/numeric/totals_spec.rb
|
142
143
|
- spec/trick_bag/operators/operators_spec.rb
|
144
|
+
- spec/trick_bag/parsers/yaml_tools_spec.rb
|
143
145
|
- spec/trick_bag/system_spec.rb
|
144
146
|
- spec/trick_bag/timing/timing_spec.rb
|
145
147
|
- spec/trick_bag/validations/hash_validations_spec.rb
|
@@ -191,6 +193,7 @@ test_files:
|
|
191
193
|
- spec/trick_bag/numeric/start_and_max_spec.rb
|
192
194
|
- spec/trick_bag/numeric/totals_spec.rb
|
193
195
|
- spec/trick_bag/operators/operators_spec.rb
|
196
|
+
- spec/trick_bag/parsers/yaml_tools_spec.rb
|
194
197
|
- spec/trick_bag/system_spec.rb
|
195
198
|
- spec/trick_bag/timing/timing_spec.rb
|
196
199
|
- spec/trick_bag/validations/hash_validations_spec.rb
|