tzispa_utils 0.3.3 → 0.3.4

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: 84afafd3fd443191e29cfaaa958c1f78c83d292b
4
- data.tar.gz: aad3274bc70c5260e89137f85b8e86703bfba7e8
3
+ metadata.gz: cae83b03670a46e683579694a0349d32d6d30f32
4
+ data.tar.gz: a890fed053d9a5500ff42d294c80e10381168205
5
5
  SHA512:
6
- metadata.gz: 2c31286198ed0a482900d3d9d7627148873eb6dbeac75b8685fba44770a9665a5cb7864c725191d341b586232599a4dc42adb50e6bb9a2f04671c70182da9602
7
- data.tar.gz: ebf06ff22e556514145b72097c80431fb20291be7dbce30d2ad1e8b4b1d22468950d5331fb42dd45c359c211a6b461626659aed1ff9e59ae99686f1d8f43a368
6
+ metadata.gz: bbe54049247c675e359be1a7299c06bc37644aef2439dcd269738ac218d8d4d54459778095bcb64e84b11eafd146b018d84c0bc216c819cd81123ffb8db84621
7
+ data.tar.gz: 0f1781a885ce2e16c036e226cee81af03443d3a970abbf5e8477308c1fa5b3680f6c2186efc6b81ca937b5dd1e7001a824de7dcb24e5d52dac4a2993a478940b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  Tzispa Utils
2
2
 
3
+ ## v0.3.4
4
+ - added string refienment methods: integer? blank?
5
+
3
6
  ## v0.3.3
4
7
  - added new string refinement methods: to_bool, sanitize_filename
5
8
  - optimizations in hash refinement symbolize methods
@@ -144,6 +144,16 @@ module Tzispa
144
144
  raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
145
145
  end
146
146
  alias_method :to_boolean, :to_bool
147
+
148
+ def integer?(base = 10)
149
+ Integer(self, base)
150
+ rescue
151
+ false
152
+ end
153
+
154
+ def blank?
155
+ match?(/\A\s*\z/)
156
+ end
147
157
  end
148
158
 
149
159
  refine String.singleton_class do
@@ -189,6 +199,18 @@ module Tzispa
189
199
  String.new(str).unescape_html
190
200
  end
191
201
  alias_method :unescape_htm, :unescape_html
202
+
203
+ def to_bool(str)
204
+ String.new(str).to_bool
205
+ end
206
+
207
+ def integer?(str, base = 10)
208
+ String.new(str).integer?(base)
209
+ end
210
+
211
+ def blank?
212
+ String.new(str).blank?
213
+ end
192
214
  end
193
215
 
194
216
  end
@@ -3,7 +3,7 @@
3
3
  module Tzispa
4
4
  module Utils
5
5
 
6
- VERSION = '0.3.3'
6
+ VERSION = '0.3.4'
7
7
  NAME = 'Tzispa Utils'
8
8
  GEM_NAME = 'tzispa_utils'
9
9
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tzispa_utils
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
  - Juan Antonio Piñero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-21 00:00:00.000000000 Z
11
+ date: 2017-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n