fractional 1.1.0 → 1.2.0

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
  SHA1:
3
- metadata.gz: 113941347da803b9e0f57e563c0f63061cd3903b
4
- data.tar.gz: 4b68768934859d192abc47b3962cc67cecb2f10e
3
+ metadata.gz: bf16c52b37e110020de5ba81093c8c32dbb8c252
4
+ data.tar.gz: df91e571f26e25d8b7d182625dbd4b194a3970ce
5
5
  SHA512:
6
- metadata.gz: 035b92227c95a2652666c85a52c28b272d32d854388e6475a84b83b85371d38ad823aa0414e660a1d4334d316bb66687d154eafa3ab1d649fabfc79b2cf715f6
7
- data.tar.gz: 4885f100ddb7365f7b67d65838067044e0daf526f57f8024f762d05cef8dbdbd1f36e71b0a73ced98166d0a6abab399a3daf48836d4bcf27ef69d9b68492628b
6
+ metadata.gz: 8475b78b70e2cb066ed13d0471c20d91fd06f55ae7182d7d9fff8825c0b8acaed8eb6d7a3446cdbe88d548d4557e7fbff5ed45b6f622190759ef98d466fbe4cb
7
+ data.tar.gz: 9f038a12f72a85ecbd796573c1f2f06a76a5c165df1b5adc5b207945528ba7a6d9d4c4989a052e03a44bc1714d834c98f038a7d0254ece9e744fbaeaa0adc54a
@@ -67,7 +67,9 @@ Joey Aghion https://github.com/joeyAghion
67
67
 
68
68
  muff1nman https://github.com/muff1nman
69
69
 
70
+ Alex Nigomatulin https://github.com/GeNiuS69
71
+
70
72
 
71
73
  == Copyright
72
74
 
73
- Copyright (c) 2009-2013 Chris O'Sullivan. See LICENSE for details.
75
+ Copyright (c) 2009-2016 Chris O'Sullivan. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.2.0
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "fractional"
3
- spec.version = "1.1.0"
3
+ spec.version = "1.2.0"
4
4
  spec.authors = ["Chris O'Sullivan"]
5
5
  spec.email = ["thechrisoshow@gmail.com"]
6
6
  spec.description = %q{Fractional is a Ruby library for parsing fractions.}
@@ -39,7 +39,11 @@ class Fractional < Numeric
39
39
  to_join << whole_part.to_s
40
40
  end
41
41
  if fractional_part != 0
42
- to_join << fractional_part.abs.to_s
42
+ if whole_part != 0
43
+ to_join << fractional_part.abs.to_s
44
+ else
45
+ to_join << fractional_part.to_s
46
+ end
43
47
  end
44
48
  to_join.join(" ")
45
49
  else
@@ -241,8 +245,8 @@ class Fractional < Numeric
241
245
  end
242
246
  end
243
247
 
244
- # Display numbers in human-readable manner.
245
- # Examples: 0.5 -> 1/2, 2.333 -> 2 1/3, 0.666 -> 2/3 etc.
248
+ # Display numbers in human-readable manner.
249
+ # Examples: 0.5 -> 1/2, 2.333 -> 2 1/3, 0.666 -> 2/3 etc.
246
250
  #
247
251
  def self.round_to_human_fraction(value)
248
252
  numeric_to_mixed_number value.rationalize(Rational('0.01'))
@@ -381,7 +381,9 @@ describe "Fractional#to_s" do
381
381
  Fractional.new(Rational(-3,2)).to_s(mixed_number: true).should == "-1 1/2"
382
382
  Fractional.new(1.00).to_s(mixed_number: true).should == "1"
383
383
  Fractional.new(0.75).to_s(mixed_number: true).should == "3/4"
384
+ Fractional.new('-1/2').to_s(mixed_number: true).should == "-1/2"
384
385
  end
386
+
385
387
  end
386
388
 
387
389
  describe "Fractional#to_f" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fractional
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris O'Sullivan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-18 00:00:00.000000000 Z
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  requirements: []
107
107
  rubyforge_project:
108
- rubygems_version: 2.4.8
108
+ rubygems_version: 2.5.1
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: 'You can use fractional to convert decimal numbers to string representations
@@ -113,3 +113,4 @@ summary: 'You can use fractional to convert decimal numbers to string representa
113
113
  test_files:
114
114
  - spec/fractional_spec.rb
115
115
  - spec/spec_helper.rb
116
+ has_rdoc: