ordinalize 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/ordinalize.rb +10 -4
- data/ordinalize.gemspec +1 -1
- data/spec/ordinalize_spec.rb +1 -0
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/ordinalize.rb
CHANGED
@@ -13,19 +13,25 @@ module Ordinalize
|
|
13
13
|
humanized.gsub!(/ty$/, 'tieth')
|
14
14
|
|
15
15
|
output = conversions[humanized] if conversions[humanized]
|
16
|
-
output ||=
|
16
|
+
output ||= split_dashes if split_dashes != ""
|
17
|
+
output ||= split_spaces if split_spaces != ""
|
17
18
|
output ||= humanized
|
18
19
|
end
|
19
20
|
|
20
21
|
alias_method :ordinalise, :ordinalize
|
21
22
|
|
22
|
-
def
|
23
|
-
|
24
|
-
parts = humanized.split("-")
|
23
|
+
def split_dashes
|
24
|
+
parts = humanize.split("-")
|
25
25
|
parts[-1] = conversions[parts.last]
|
26
26
|
parts.join("-")
|
27
27
|
end
|
28
28
|
|
29
|
+
def split_spaces
|
30
|
+
parts = humanize.split(" ")
|
31
|
+
parts[-1] = conversions[parts.last]
|
32
|
+
parts.join(" ")
|
33
|
+
end
|
34
|
+
|
29
35
|
def conversions
|
30
36
|
{
|
31
37
|
"one" => "first",
|
data/ordinalize.gemspec
CHANGED
data/spec/ordinalize_spec.rb
CHANGED