creative_rails_utilities 0.3.2 → 0.3.3
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +9 -1
- data/lib/creative_rails_utilities/numeric.rb +13 -0
- data/lib/creative_rails_utilities/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 942d11bff39c8a0304c0486b6d16ae7f5d5a9782
|
4
|
+
data.tar.gz: 79d15bd93fd7dacc1c932fd4577c5501fa988a08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6d975dea6bf6654956122e50a268335469d0616660a8e4fda389ec2d7aadd3c2e29c812f97709cec4d7e211433aa4c854b510a17a854d6317032ed3b9fcc237
|
7
|
+
data.tar.gz: e127ec706ad345a6d175b645a2fd6778e3046b5ec414d402e2f61ce16dd28a5e3af1a1feaac787d9eb446d9ed1eaf25d3c1f728bc4d1cd237cacdced33efbf43
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,7 @@ Intended for `Rails >= 4.0.0`, but will probably work for older projects with ro
|
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
-
`gem 'creative_rails_utilities', "~> 0.3.
|
9
|
+
`gem 'creative_rails_utilities', "~> 0.3.3"` and `bundle`
|
10
10
|
|
11
11
|
## Usage
|
12
12
|
|
@@ -142,6 +142,13 @@ some_hash.fast_sort_keys #=> some_sorted_hash
|
|
142
142
|
0.safe_percent(0) #=> 0
|
143
143
|
```
|
144
144
|
|
145
|
+
```ruby
|
146
|
+
# transform a Numeric that denotes seconds into a hash of how many :days, :hours, :minutes ad :seconds that is
|
147
|
+
61.5.to_time_hash #=> {days: 0, hours: 0, minutes: 1, seconds: 1.5}
|
148
|
+
2775721.to_time_hash #=> {days: 32, hours: 3, minutes: 2, seconds: 1}
|
149
|
+
(Time.zone.now.to_i - 3.minutes.ago.to_i).to_time_hash #=> {days: 0, hours: 0, minutes: 3, seconds: 0}
|
150
|
+
```
|
151
|
+
|
145
152
|
##### String
|
146
153
|
|
147
154
|
```ruby
|
@@ -170,6 +177,7 @@ string #=> "1..." instead of " 1..."
|
|
170
177
|
```ruby
|
171
178
|
# Convert string to boolean.
|
172
179
|
"true".to_bool #=> true
|
180
|
+
"faLSE".to_bool #=> false # yup, case insensitive
|
173
181
|
"0".to_bool #=> false
|
174
182
|
"".to_bool #=> false
|
175
183
|
"y".to_bool #=> true
|