midwire_common 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/README.md +1 -1
- data/lib/midwire_common/string.rb +6 -6
- data/lib/midwire_common/version.rb +1 -1
- data/spec/lib/midwire_common/string_spec.rb +3 -3
- 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: 4677c1584c5c35e20addcfa6e40dc60919b1813b
|
4
|
+
data.tar.gz: 6f16246a5e91000ba332144220458ce99e19c3a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8a4e99cb0a6f1d9619ea07f17c55f11ee33f09d5c275258454575d6dd6e38817463fd0e74702b523e33d968cbb7e63b5b18d3684de520714a84ba15ec012757
|
7
|
+
data.tar.gz: c4c0cd3bd83b2663901853a409251315f1e72420598ff2b4fbf5a0aae3bb7bab04e672594d33f56e9cbd9b1bebf3d21f65c4d578c40325a57b9b6252c1ef7e49
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -7,11 +7,11 @@ class String
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
10
|
+
def left_substr(count)
|
11
11
|
slice(0, count)
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
14
|
+
def right_substr(count)
|
15
15
|
slice(-count, count)
|
16
16
|
end
|
17
17
|
|
@@ -115,10 +115,10 @@ class String
|
|
115
115
|
|
116
116
|
def snakerize
|
117
117
|
gsub(/::/, '/')
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
118
|
+
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
119
|
+
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
120
|
+
.tr('-', '_')
|
121
|
+
.downcase
|
122
122
|
end
|
123
123
|
|
124
124
|
# rubocop:disable Style/PerlBackrefs
|
@@ -14,11 +14,11 @@ RSpec.describe String do
|
|
14
14
|
|
15
15
|
context 'slicing methods' do
|
16
16
|
it "'left' returns the leftmost 'n' characters" do
|
17
|
-
'My Bogus String'.
|
17
|
+
'My Bogus String'.left_substr(2).should == 'My'
|
18
18
|
end
|
19
19
|
|
20
20
|
it "'right' returns the rightmost 'n' characters " do
|
21
|
-
'My Bogus String'.
|
21
|
+
'My Bogus String'.right_substr(2).should == 'ng'
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -124,7 +124,7 @@ RSpec.describe String do
|
|
124
124
|
|
125
125
|
it 'escapes double quotes' do
|
126
126
|
expect('this is a "test"'.escape_double_quotes)
|
127
|
-
|
127
|
+
.to eq('this is a \\\\"test\\\\"')
|
128
128
|
end
|
129
129
|
end
|
130
130
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: midwire_common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Blackburn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|