cardname 0.6.6 → 0.6.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cardname/manipulate.rb +7 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db7c6cbb2e07aa1c15501480e2557d1299c5bcaa
4
- data.tar.gz: 801e90c31e1adab4ccbc74ee0a3a13209dc9a0a3
3
+ metadata.gz: 4ed97c3a3d4c8f759043bab63aa62acb395084a6
4
+ data.tar.gz: 6c6155a43a47dc1de73b171cac50c0e144db0b7a
5
5
  SHA512:
6
- metadata.gz: f8bef6a1528797e31190efe86cf5528aec0141c86bb1e4e643d2a755ec6c7e466255481ca0c7a3539ab5cc50540bce00662a5291e2a577800c0fed36b291dd6c
7
- data.tar.gz: 744706107b4010d2c59e11a828df73d8d0282966c3bd865829db4ca12d3a6ee286e7a7d53e81f2ba22fe5b1ce1b97a2b539788827c6cf02b3e021b4195480ad3
6
+ metadata.gz: 5971cc81e95630323af3f5a9f51042274905b6d753516760ba6be2a8af1a8bc9fb1de7f2097e9b423ead921d458f768d7d9de45ec81da57f09f228406d17fb2e
7
+ data.tar.gz: 686d2d6b9d58f4f20b2e0f7db58811aaa899b8433dc114ed672bfbf616427689dc07c764face09c891fd2172a7a8f244c812ee87fdaca093d7345bc55701193e
@@ -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.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-11-30 00:00:00.000000000 Z
13
+ date: 2018-12-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport