gruber-case 0.0.4 → 0.0.5

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 +8 -8
  2. data/lib/gruber-case.rb +5 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MWUwYzQ2MDFjYzkyNWJmNzVmNmQ5YmFhZDJmZjVkYjA3NjIwZTU4Yg==
4
+ ZDY5ZmE4MjBkZjk0ZmE5MDUyNTFmMjU1NDQzNDIzNmE2MmZiYmJlZQ==
5
5
  data.tar.gz: !binary |-
6
- OGNlOWRjZWFmYWFkZTBmMDhmODJkZDJiZmNiOTAxZjVkZGNhNGM4Yg==
6
+ YmU0N2ZhZGE2OTk2MGVjZjI3NzY0YzU1MjM0ZjUwMDdiZmRjNzM3MQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWU0N2RhMjI2MDQ2YzNlOTkyZTJkOTBkNGU4YzMzNTRlYWMzNjVhZWY5NTc2
10
- ODYzMjkxNWY4NzQ3OTY4YWNkOWZkMTlkMmMwYzEwNWVhMDcxZTIxNTY3YmM3
11
- N2NiMTQwZmE5NWUyNDFlZTk4MzI1MDVlYzFkNzNlYTNmNjQzNTE=
9
+ Yjg4MGQ2OWYxZTVjYTAyNjRhNmU2OGY1MTBlOWNkNGQyNjM5NTE1NTAxNGRi
10
+ YjgwNGQxZTcwMmVlMjdmYWZiNzJhZGI0NzU0ZmQyZTJiOTExYjZmMTc3ZmE3
11
+ ZDk3YmM5NzRhMTZiMWJjZTFkOTE3OWQ4ZDU1ZGU3N2I4OGE2N2M=
12
12
  data.tar.gz: !binary |-
13
- ZjBhNTRmYmVkNTQyN2VlMDRlNDc1NTM2NDVlZmQyZDA0MjgzZDY0MTI0NzU1
14
- MTNkNDY5NGUwZTVkMDY3NzhhNTQwMzZhNzUxZWE1ZWVmMDk2M2NkY2VmYWNj
15
- YjQ4YzMwZGQxOWM0ZjlhNmMyNDM5YWU0MjU2ZmI4OTZhODA3NDc=
13
+ MDJhYzg5ZDQ2ODNjODAwYjJjNDRhZDFjNjM5N2QxNDJhNjU1NWE1Y2E1Mzhi
14
+ ZjU0OGI3MDQxZjRiMDIyOGRhZDU2OTllNzVlYjQwMTRlNTdmMmU4YmZhNTU4
15
+ NGQwYTFkNjgzODMzOWQzZjhlOWVjMjE5MDBiMGMwOGNlM2Q1MGE=
data/lib/gruber-case.rb CHANGED
@@ -40,7 +40,11 @@ class String
40
40
  def namecase
41
41
  small_words = ["'s", "'t", "aan", "aan 't", "aan de", "aan den", "aan der", "aan het", "al", "auf", "aus", "bij", "bij 't", "bij de", "bij den", "bij het", "boven d'", "d'", "da[s]?", "dalla", "de", "de die", "de die le", "de l'", "de la", "de las", "de le", "de van der", "del", "della", "den", "der", "des", "di", "do[s]?", "el", "het", "in", "in 't", "in de", "in den", "in der", "in het", "onder", "onder 't", "onder de", "onder den", "onder het", "op", "op 't", "op de", "op den", "op der", "op gen", "op het", "op ten", "over", "over 't", "over de", "over den", "over het", "saint", "st", "ste", "te", "ten", "ter", "tot", "uijt", "uijt 't", "uijt de", "uijt den", "uijt het", "uijt te de", "uijt ten", "uit", "uit 't", "uit de", "uit den", "uit het", "uit te de", "uit ten", "van 't", "van de", "van de l'", "van den", "van der", "van gen", "van het", "van la", "van ter", "van van de", "vander", "ver", "voor", "voor de", "voor den", "voor in 't"]
42
42
  small_re = small_words.join('|')
43
- s = self.split(" ").map { |word| word.split("-").map(&:capitalize).join("-") }.join(" ")
43
+ s = self.split(" ").map do |word|
44
+ result = word.split("-").map(&:capitalize).join("-")
45
+ result.upcase! if result =~ /([a-z]\.){1,3}/i
46
+ result
47
+ end.join(" ")
44
48
  s.gsub!(/'\w/io) { |w| w.upcase }
45
49
  s.gsub!(/\b(#{small_re})\b/io) { |w| w.downcase }
46
50
  s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gruber-case
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Jackson
@@ -37,7 +37,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
37
37
  version: '0'
38
38
  requirements: []
39
39
  rubyforge_project:
40
- rubygems_version: 2.1.11
40
+ rubygems_version: 2.2.2
41
41
  signing_key:
42
42
  specification_version: 4
43
43
  summary: Gruber Case