creative_rails_utilities 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c11e2d81b41c9250fa934fe3351ff2b91f27d1e1
4
- data.tar.gz: 10374464c1ed042a4ac75fb91c8cceb3f1d5082f
3
+ metadata.gz: 917c83b2eecccff1d15e944588440306749d9884
4
+ data.tar.gz: f967b3848f59fe7b307bb161d4b6bf7973edb0d3
5
5
  SHA512:
6
- metadata.gz: 0290b96140235311179d75a50df9b9b21691c37c344ec5f70a320ff6257526756696a3a15f1b5dc20794e15e33856cebcad2f03231840440a78a6989d9f2bbb9
7
- data.tar.gz: 760f094be9e34f0aae9a76bf811a4f077c7dc81b76132df2279673bd4bc9d08b62a7ff2232dec252a9cfdfb6a9b5118980b8f8fd7ef5709b409ee3b63851fb35
6
+ metadata.gz: ae632aac59b682631cb0e92e620701995e91850f70f31980a9722615e6ba0313678ecfd35a98e6a2706bd0954c96a1baa9a6eb56c27ed6881393dd889f52ce88
7
+ data.tar.gz: 2d90907055cbb0f4b2fef60ea359a2c03f8d56291639d2745637e541e378f7653089539dd49a19f4611bda5d4eef2a69e2d9a2cbebcadbd2e0126146852b44fb
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
6
6
  ### Added
7
7
  -
8
8
 
9
+ ## [0.3.1] - 2016-10-21
10
+ ### Added
11
+ - String#unindent
12
+
9
13
  ## [0.3.0] - 2015-12-10
10
14
  ### Added
11
15
  - ViewHelper module for Rails
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 localication key location and returns the correct value based on the hash returned by `relative_time_parse`
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
 
@@ -16,4 +16,8 @@ class String
16
16
  return strip.gsub(/\s{2,}/, ' ')
17
17
  end
18
18
 
19
+ def unindent
20
+ gsub(/^#{self[/\A\s*/]}/, '')
21
+ end
22
+
19
23
  end
@@ -1,3 +1,3 @@
1
1
  module CreativeRailsUtilities
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
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.0
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: 2015-12-10 00:00:00.000000000 Z
11
+ date: 2016-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport