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 CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -13,19 +13,25 @@ module Ordinalize
13
13
  humanized.gsub!(/ty$/, 'tieth')
14
14
 
15
15
  output = conversions[humanized] if conversions[humanized]
16
- output ||= split if split != ""
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 split
23
- humanized = self.humanize
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",
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ordinalize}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ryan Bigg"]
@@ -31,6 +31,7 @@ describe "Ordinalize" do
31
31
  [27, "twenty-seventh"],
32
32
  [28, "twenty-eighth"],
33
33
  [29, "twenty-ninth"],
34
+ [1005, "one thousand and fifth"],
34
35
  [1024, "one thousand and twenty-fourth"]
35
36
  ].each do |num, expected|
36
37
  it "#{num} should be #{expected}" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ordinalize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bigg