creative_rails_utilities 0.3.3 → 0.3.4

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: 942d11bff39c8a0304c0486b6d16ae7f5d5a9782
4
- data.tar.gz: 79d15bd93fd7dacc1c932fd4577c5501fa988a08
3
+ metadata.gz: cdd3d6caac11d31bd5f37840741a9ce10c3ad74c
4
+ data.tar.gz: 286be8688274236cdec3f70837fa0096e8561136
5
5
  SHA512:
6
- metadata.gz: f6d975dea6bf6654956122e50a268335469d0616660a8e4fda389ec2d7aadd3c2e29c812f97709cec4d7e211433aa4c854b510a17a854d6317032ed3b9fcc237
7
- data.tar.gz: e127ec706ad345a6d175b645a2fd6778e3046b5ec414d402e2f61ce16dd28a5e3af1a1feaac787d9eb446d9ed1eaf25d3c1f728bc4d1cd237cacdced33efbf43
6
+ metadata.gz: b1449234065a49d2e1d4901f110dde01ff2ac33ed401c795a8242dbb433ebe1f1723f2af84185b975182385227cbc13a46d3786bb86ca86b96bdf634eee0b5c1
7
+ data.tar.gz: d2dea52abbfaf5075581efbb3ee7a0e21b191501dddec868447960e24b2b4aca94d7c6082133d338c144cd7f334c245cd9c8d738eabdced06276bd29dead5433
data/CHANGELOG.md CHANGED
@@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
8
8
  -
9
9
  ```
10
10
 
11
+ ## [0.3.4] - 2016-04-20
12
+ ### Updated
13
+ - Numeric#safe_percent to accept the optional :precision keyword argument
14
+
11
15
  ## [0.3.3] - 2016-04-19
12
16
  ### Added
13
17
  - Numeric#to_time_hash
data/README.md CHANGED
@@ -139,6 +139,7 @@ some_hash.fast_sort_keys #=> some_sorted_hash
139
139
  100.safe_percent(50) #=> 50
140
140
  1.safe_percent(2) #=> 200
141
141
  3.0.safe_percent(1) #=> 33.333333333333336 # you should .round when calling this on floats
142
+ 3.0.safe_percent(1, precision: 2) #=> 33.33 # As of 0.3.4 you can have precision
142
143
  0.safe_percent(0) #=> 0
143
144
  ```
144
145
 
@@ -29,10 +29,10 @@ class Numeric
29
29
  end
30
30
  end
31
31
 
32
- def safe_percent(part)
32
+ def safe_percent(part, precision: 15)
33
33
  if self > 0
34
34
  if part >= 0
35
- return safe_part(part)*100
35
+ return (safe_part(part)*100).round(precision)
36
36
  else
37
37
  raise_positive_number_only
38
38
  end
@@ -1,3 +1,3 @@
1
1
  module CreativeRailsUtilities
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: creative_rails_utilities
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Creative
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2016-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport