cardname 0.6.6 → 0.6.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cardname/manipulate.rb +7 -0
- 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: 4ed97c3a3d4c8f759043bab63aa62acb395084a6
|
4
|
+
data.tar.gz: 6c6155a43a47dc1de73b171cac50c0e144db0b7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5971cc81e95630323af3f5a9f51042274905b6d753516760ba6be2a8af1a8bc9fb1de7f2097e9b423ead921d458f768d7d9de45ec81da57f09f228406d17fb2e
|
7
|
+
data.tar.gz: 686d2d6b9d58f4f20b2e0f7db58811aaa899b8433dc114ed672bfbf616427689dc07c764face09c891fd2172a7a8f244c812ee87fdaca093d7345bc55701193e
|
data/lib/cardname/manipulate.rb
CHANGED
@@ -41,6 +41,13 @@ class Cardname
|
|
41
41
|
self =~ /^#{Regexp.escape joint}/ ? self : (joint + self)
|
42
42
|
end
|
43
43
|
|
44
|
+
def sub_in str, with:
|
45
|
+
%i[capitalize downcase].product(%i[pluralize singularize])
|
46
|
+
.inject(str) do |s, (m1, m2)|
|
47
|
+
s.gsub(/\b#{send(m1).send(m2)}\b/, with.send(m1).send(m2))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
44
51
|
alias_method :to_field, :prepend_joint
|
45
52
|
|
46
53
|
private
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cardname
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-12-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|