creative_rails_utilities 0.3.0 → 0.3.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +21 -1
- data/lib/creative_rails_utilities/string.rb +4 -0
- data/lib/creative_rails_utilities/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 917c83b2eecccff1d15e944588440306749d9884
|
4
|
+
data.tar.gz: f967b3848f59fe7b307bb161d4b6bf7973edb0d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae632aac59b682631cb0e92e620701995e91850f70f31980a9722615e6ba0313678ecfd35a98e6a2706bd0954c96a1baa9a6eb56c27ed6881393dd889f52ce88
|
7
|
+
data.tar.gz: 2d90907055cbb0f4b2fef60ea359a2c03f8d56291639d2745637e541e378f7653089539dd49a19f4611bda5d4eef2a69e2d9a2cbebcadbd2e0126146852b44fb
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -64,7 +64,7 @@ en:
|
|
64
64
|
days: "%{count} days ago"
|
65
65
|
```
|
66
66
|
|
67
|
-
Then you can write a simple helper that specifies
|
67
|
+
Then you can write a simple helper that specifies localization key location and returns the correct value based on the hash returned by `relative_time_parse`
|
68
68
|
```ruby
|
69
69
|
def relative_short_time(t1, t2=nil)
|
70
70
|
hash = relative_time_parse(t1, t2)
|
@@ -125,6 +125,14 @@ some_hash.fast_sort_keys #=> some_sorted_hash
|
|
125
125
|
28.to_s26 #=> "ab"
|
126
126
|
```
|
127
127
|
|
128
|
+
```ruby
|
129
|
+
# get a part even when deleting with zero
|
130
|
+
# whole.safe_part(part)
|
131
|
+
100.safe_part(50) #=> 0.5
|
132
|
+
1.safe_part(2) #=> 2
|
133
|
+
0.safe_part(0) #=> 0
|
134
|
+
```
|
135
|
+
|
128
136
|
```ruby
|
129
137
|
# get a percent even when deleting with zero
|
130
138
|
# whole.safe_percent(part)
|
@@ -146,6 +154,18 @@ some_hash.fast_sort_keys #=> some_sorted_hash
|
|
146
154
|
" z z ".clean_whitespace #=> "z z"
|
147
155
|
```
|
148
156
|
|
157
|
+
```ruby
|
158
|
+
# Unindent here doc type strings to the indentation level of first line
|
159
|
+
string = <<-ENDBAR.unindent
|
160
|
+
1
|
161
|
+
2
|
162
|
+
3
|
163
|
+
1
|
164
|
+
ENDBAR
|
165
|
+
|
166
|
+
string #=> "1..." instead of " 1..."
|
167
|
+
```
|
168
|
+
|
149
169
|
## Development
|
150
170
|
Use ruby >=2.1
|
151
171
|
|
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.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Creative
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|