romanumerals 0.2.0 → 0.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89ee3edbf76f972387873e7c65abb886ffacfc0c20f4c5cd761dcbfbea6cd4c0
4
- data.tar.gz: b92715147ea27d486218dba49c450b4dc7697f1c2c38c87f9451a6aa44133401
3
+ metadata.gz: ce9a2c835b1abd6e4aede7c8aad10ca02abb19532da0c6389e6207deffacf96f
4
+ data.tar.gz: 8ca0e19c63694bb28ee450d88e64e9578d2a97a88a4f71b275bf35df45c93fcf
5
5
  SHA512:
6
- metadata.gz: edeb84a0cc156f64f236b13b91e7fac471c6b5064f0be2a715fadb941aa38138bbf2599ccb6239fa40fcc1ec7d371989806f6abcec2f3651a19f5560feab0c5a
7
- data.tar.gz: 762a9db1bff5156091188d631fff66123f3ce411b6bc8077c4e5e1f49095d4b06722d23d08e739d927f648ce16f0f70169caf449f8ab7740494115835c07f553
6
+ metadata.gz: 6eb90ef45faf6f20cfd82c9cbc5f73139dd161f9bac6be11f85b30a41463a54c547dae130f3ae716e2bc9083ec9b4195f9ab34bcfbed9a3868dede773a70bb4a
7
+ data.tar.gz: b292909557427f0ab63deca96206de50cea434b63dc106590be8711e18c3d2fce03608013affe0b5d8d4e6611fa3c9f3b7e0c45c3107f23a7c2ecd85b589f7e9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- romanumerals (0.1.2)
4
+ romanumerals (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -18,6 +18,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
18
18
 
19
19
  Usage is very simple:
20
20
 
21
+ #### Convert to roman:
21
22
  ```ruby
22
23
  10.to_roman # => "X"
23
24
  110.to_roman # => "CX"
@@ -27,6 +28,23 @@ Usage is very simple:
27
28
  2022.to_roman # => "MMXXII"
28
29
  ```
29
30
 
31
+ #### Convert from roman:
32
+ ```ruby
33
+ 'MMXXII'.to_numeral # => 2022
34
+ ```
35
+
36
+ #### Other cases:
37
+ ```ruby
38
+ 0.to_roman # => ""
39
+ 11.9.to_roman # => "XI"
40
+
41
+ # If a string does not contain roman numerals then the String#to_i will be used
42
+ ''.to_numeral # => 0
43
+ '0'.to_numeral # => 0
44
+ 'XIIi'.to_numeral # => 0
45
+ '5 contributors'.to_numeral # => 5
46
+ ```
47
+
30
48
  ## Contributing
31
49
 
32
50
  Bug reports and pull requests are welcome on GitHub at https://github.com/febonazzic/romanumerals.
@@ -6,12 +6,7 @@ module Romanumerals
6
6
  return '' if zero?
7
7
 
8
8
  decompose.each_with_object([]) do |(divider, count), result|
9
- result <<
10
- if count == 4
11
- DICTIONARY[divider] + DICTIONARY[divider * 5]
12
- else
13
- DICTIONARY[divider] * count
14
- end
9
+ result << DICTIONARY[divider] * count
15
10
  end.join
16
11
  end
17
12
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Romanumerals
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: romanumerals
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - febonazzic