ordinator 1.0.1

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 +7 -0
  2. data/lib/ordinator.rb +19 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 61921ea8281e40b456f53a1b91abb763f6dbb460
4
+ data.tar.gz: cc3cd33e7a39fd2c08f6721fae9a3ec62eff83d1
5
+ SHA512:
6
+ metadata.gz: b2565e53a82d696aba572e62397d4a1fd89c937c48a37b17723025a1abc25b165cba6033b8acd0458df47f1d4463258295d23acbf5c511a309dae3c4ec528426
7
+ data.tar.gz: d2a10a303988592852e162c327fb778349e9cadee473fad520dd7ddfd617b351502ebb1e7904ae8f0d2da2e18669296c064a775649690d5cdf7b0b11efcb25b8
data/lib/ordinator.rb ADDED
@@ -0,0 +1,19 @@
1
+ class Ordinator
2
+ def self.convert(number)
3
+ final_two = number % 100
4
+ if final_two == 11 || final_two == 12 || final_two == 13 then
5
+ return "#{number}th"
6
+ else
7
+ case number % 10
8
+ when 1
9
+ return "#{number}st"
10
+ when 2
11
+ return "#{number}nd"
12
+ when 3
13
+ return "#{number}rd"
14
+ else
15
+ return "#{number}th"
16
+ end
17
+ end
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ordinator
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Devan Hurst
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-25 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Input an integer (3), get an ordinal string ('3rd') back!
14
+ email: devan.hurst@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/ordinator.rb
20
+ homepage: http://rubygems.org/gems/ordinator
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.5.0
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: 'Ordinator: Turns integers into ordinal strings!'
44
+ test_files: []