roman_numbers 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/roman_numbers/version.rb +1 -1
- data/roman_numbers.gemspec +2 -2
- data/spec/helpers.rb +30 -30
- data/spec/roman_numbers/roman_number_spec.rb +6 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef894b8b04ca12f5e8c4db294b242e84403ac80f
|
4
|
+
data.tar.gz: 41b70cb81805321baa09518bbdd561ce9c6f91f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fce4ebb4b730a4df020ff976595e2285159e18397c0f6249346c68d24716d80e5c6328ce0a4f324398efe3cca230fd3eff71aed3d096c4e02a98e6fd2738a8af
|
7
|
+
data.tar.gz: 4f54c23dc9015dd820731022b28e3523ed3e776143ddabf63edbf2761a3394ee2d3cfe658a5e343d4f304cb9b0032a21762ef613799e3f58ff21d32924097434
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# RomanNumbers
|
2
2
|
|
3
|
-
Conversion between
|
3
|
+
Conversion between Decimals and Roman Numbers
|
4
4
|
|
5
5
|
Roman numerals are based on seven symbols:
|
6
6
|
|
@@ -64,7 +64,7 @@ By explicitly using RomanNumber class:
|
|
64
64
|
By directly on String and Integer objects:
|
65
65
|
|
66
66
|
|
67
|
-
> 'MCMXLIV'.
|
67
|
+
> 'MCMXLIV'.from_roman_to_decimal
|
68
68
|
|
69
69
|
1944
|
70
70
|
|
@@ -74,7 +74,7 @@ By directly on String and Integer objects:
|
|
74
74
|
"MCMXLIV"
|
75
75
|
|
76
76
|
|
77
|
-
> 'MMMMMX'.
|
77
|
+
> 'MMMMMX'.from_roman_to_decimal
|
78
78
|
|
79
79
|
RomanNumbers::InvalidInputError
|
80
80
|
|
data/roman_numbers.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = RomanNumbers::VERSION
|
9
9
|
spec.authors = ["Munish Goyal"]
|
10
10
|
spec.email = ["munishapc@gmail.com"]
|
11
|
-
spec.summary = %q{Conversion between
|
12
|
-
spec.description = %q{Conversion between
|
11
|
+
spec.summary = %q{Conversion between Decimals and Roman Numbers}
|
12
|
+
spec.description = %q{Conversion between Decimals and Roman Numbers}
|
13
13
|
spec.homepage = "https://github.com/goyalmunish/roman_numbers"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
data/spec/helpers.rb
CHANGED
@@ -1,46 +1,46 @@
|
|
1
1
|
module Helpers
|
2
2
|
def input_set_1
|
3
3
|
[
|
4
|
-
{
|
5
|
-
{
|
4
|
+
{decimal: 39, roman: 'XXXIX'},
|
5
|
+
{decimal: 390, roman: 'CCCXC'},
|
6
6
|
]
|
7
7
|
end
|
8
8
|
module_function :input_set_1
|
9
9
|
def input_set_2
|
10
10
|
[
|
11
|
-
{
|
12
|
-
{
|
13
|
-
{
|
14
|
-
{
|
15
|
-
{
|
16
|
-
{
|
11
|
+
{decimal: 4, roman: 'IV'},
|
12
|
+
{decimal: 9, roman: 'IX'},
|
13
|
+
{decimal: 40, roman: 'XL'},
|
14
|
+
{decimal: 90, roman: 'XC'},
|
15
|
+
{decimal: 400, roman: 'CD'},
|
16
|
+
{decimal: 900, roman: 'CM'},
|
17
17
|
]
|
18
18
|
end
|
19
19
|
module_function :input_set_2
|
20
20
|
def valid_inputs
|
21
21
|
[
|
22
|
-
{
|
23
|
-
{
|
24
|
-
{
|
25
|
-
{
|
26
|
-
{
|
27
|
-
{
|
28
|
-
{
|
29
|
-
{
|
30
|
-
{
|
31
|
-
{
|
32
|
-
{
|
33
|
-
{
|
34
|
-
{
|
35
|
-
{
|
36
|
-
{
|
37
|
-
{
|
38
|
-
{
|
39
|
-
{
|
40
|
-
{
|
41
|
-
{
|
42
|
-
{
|
43
|
-
{
|
22
|
+
{decimal: 1, roman: 'I'},
|
23
|
+
{decimal: 5, roman: 'V'},
|
24
|
+
{decimal: 10, roman: 'X'},
|
25
|
+
{decimal: 50, roman: 'L'},
|
26
|
+
{decimal: 100, roman: 'C'},
|
27
|
+
{decimal: 500, roman: 'D'},
|
28
|
+
{decimal: 1000, roman: 'M'},
|
29
|
+
{decimal: 4, roman: 'IV'},
|
30
|
+
{decimal: 9, roman: 'IX'},
|
31
|
+
{decimal: 40, roman: 'XL'},
|
32
|
+
{decimal: 90, roman: 'XC'},
|
33
|
+
{decimal: 400, roman: 'CD'},
|
34
|
+
{decimal: 900, roman: 'CM'},
|
35
|
+
{decimal: 207, roman: 'CCVII'},
|
36
|
+
{decimal: 1066, roman: 'MLXVI'},
|
37
|
+
{decimal: 44, roman: 'XLIV'},
|
38
|
+
{decimal: 49, roman: 'XLIX'},
|
39
|
+
{decimal: 904, roman: 'CMIV'},
|
40
|
+
{decimal: 944, roman: 'CMXLIV'},
|
41
|
+
{decimal: 1904, roman: 'MCMIV'},
|
42
|
+
{decimal: 1944, roman: 'MCMXLIV'},
|
43
|
+
{decimal: 3999, roman: 'MMMCMXCIX'},
|
44
44
|
]
|
45
45
|
end
|
46
46
|
module_function :valid_inputs
|
@@ -13,8 +13,8 @@ module RomanNumbers
|
|
13
13
|
shared_examples_for "works_with_valid_integral_input_and_roman_output_collection" do |array|
|
14
14
|
# Note: here array is array of hashes
|
15
15
|
array.each do |hsh|
|
16
|
-
it %Q{returns #{hsh[:roman]} for #{hsh[:
|
17
|
-
RomanNumber.new(hsh[:
|
16
|
+
it %Q{returns #{hsh[:roman]} for #{hsh[:decimal]} as input} do
|
17
|
+
RomanNumber.new(hsh[:decimal]).convert_decimal_to_roman.should == hsh[:roman]
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -38,8 +38,8 @@ module RomanNumbers
|
|
38
38
|
shared_examples_for "works_with_valid_roman_input_and_integral_output_collection" do |array|
|
39
39
|
# Note: here array is array of hashes
|
40
40
|
array.each do |hsh|
|
41
|
-
it %Q{returns #{hsh[:
|
42
|
-
RomanNumber.new(hsh[:roman]).convert_roman_to_decimal.should == hsh[:
|
41
|
+
it %Q{returns #{hsh[:decimal]} for #{hsh[:roman]} as input} do
|
42
|
+
RomanNumber.new(hsh[:roman]).convert_roman_to_decimal.should == hsh[:decimal]
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -81,8 +81,8 @@ module RomanNumbers
|
|
81
81
|
|
82
82
|
context 'For Valid Input' do
|
83
83
|
Helpers.valid_inputs.each do |hsh|
|
84
|
-
it %Q{returns #{hsh[:roman]} for #{hsh[:
|
85
|
-
RomanNumber.new(hsh[:roman]).convert_roman_to_decimal.should == hsh[:
|
84
|
+
it %Q{returns #{hsh[:roman]} for #{hsh[:decimal]} as input} do
|
85
|
+
RomanNumber.new(hsh[:roman]).convert_roman_to_decimal.should == hsh[:decimal]
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roman_numbers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Munish Goyal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
description: Conversion between
|
97
|
+
description: Conversion between Decimals and Roman Numbers
|
98
98
|
email:
|
99
99
|
- munishapc@gmail.com
|
100
100
|
executables: []
|
@@ -140,7 +140,7 @@ rubyforge_project:
|
|
140
140
|
rubygems_version: 2.4.5
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
|
-
summary: Conversion between
|
143
|
+
summary: Conversion between Decimals and Roman Numbers
|
144
144
|
test_files:
|
145
145
|
- autotest/discover.rb
|
146
146
|
- spec/helpers.rb
|