finishing_moves 0.8 → 0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/finishing_moves.gemspec +0 -14
- data/lib/finishing_moves/string.rb +8 -0
- data/lib/finishing_moves/version.rb +1 -1
- data/spec/string_spec.rb +16 -0
- metadata +3 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 866fccad1318171c982abbbfa77150f2df07cae9
|
4
|
+
data.tar.gz: 8fca63c081718015c790a23e6f4c5a31c3b8c34c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bc558724c3c8be629cad4657abc66629e6bd6004b892b29c3263ab4b7ce385eee6436ea67212a42cdfcf07233feb39d0984d5e63f94af6651092fd79effe0d0
|
7
|
+
data.tar.gz: 65e3f054b09fc2dffc6088e25129b4471024cbd1b6e5fce1d2e672db8209ce5ec72417a2d8ea44ddec32ed985d955334605b2265a369275e53f822fc866fdf6a
|
data/.travis.yml
CHANGED
data/finishing_moves.gemspec
CHANGED
@@ -28,18 +28,4 @@ Gem::Specification.new do |s|
|
|
28
28
|
|
29
29
|
s.required_ruby_version = '>= 2.0.0'
|
30
30
|
|
31
|
-
s.post_install_message = <<EOS
|
32
|
-
********************************************************************************
|
33
|
-
|
34
|
-
Thank you for installing Finishing Moves!
|
35
|
-
|
36
|
-
Built and maintained by Forge Software
|
37
|
-
www.forgecrafted.com
|
38
|
-
|
39
|
-
Does your project or organization use this gem? Add it to the showcase page.
|
40
|
-
https://github.com/forgecrafted/finishing_moves/wiki/showcase
|
41
|
-
|
42
|
-
********************************************************************************
|
43
|
-
EOS
|
44
|
-
|
45
31
|
end
|
@@ -78,6 +78,14 @@ class String
|
|
78
78
|
match(pattern, pos).not_nil?
|
79
79
|
end
|
80
80
|
|
81
|
+
# Sources:
|
82
|
+
# http://mentalized.net/journal/2011/04/14/ruby-how-to-check-if-a-string-is-numeric/
|
83
|
+
# http://rosettacode.org/wiki/Determine_if_a_string_is_numeric#Ruby
|
84
|
+
# http://stackoverflow.com/questions/5661466/test-if-string-is-a-number-in-ruby-on-rails/5661695
|
85
|
+
def numeric?
|
86
|
+
Float(self) != nil rescue false
|
87
|
+
end
|
88
|
+
|
81
89
|
protected
|
82
90
|
|
83
91
|
def _lstrip_all_regex(expr)
|
data/spec/string_spec.rb
CHANGED
@@ -184,4 +184,20 @@ describe String do
|
|
184
184
|
expect{ '12345678'.slugify! }.not_to raise_error
|
185
185
|
end
|
186
186
|
|
187
|
+
it '#numeric?' do
|
188
|
+
expect("42".numeric?).to be true
|
189
|
+
expect("-42".numeric?).to be true
|
190
|
+
expect("1.2".numeric?).to be true
|
191
|
+
expect("0".numeric?).to be true
|
192
|
+
expect("1.2e34".numeric?).to be true
|
193
|
+
expect("1_000".numeric?).to be true
|
194
|
+
expect("".numeric?).to be false
|
195
|
+
expect(" ".numeric?).to be false
|
196
|
+
expect("a".numeric?).to be false
|
197
|
+
expect("-".numeric?).to be false
|
198
|
+
expect(".".numeric?).to be false
|
199
|
+
expect("_".numeric?).to be false
|
200
|
+
expect("1.2.3".numeric?).to be false
|
201
|
+
end
|
202
|
+
|
187
203
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: finishing_moves
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.9'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Koehl
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rb-readline
|
@@ -140,18 +140,7 @@ homepage: https://github.com/forgecrafted/finishing_moves
|
|
140
140
|
licenses:
|
141
141
|
- MIT
|
142
142
|
metadata: {}
|
143
|
-
post_install_message:
|
144
|
-
********************************************************************************
|
145
|
-
|
146
|
-
Thank you for installing Finishing Moves!
|
147
|
-
|
148
|
-
Built and maintained by Forge Software
|
149
|
-
www.forgecrafted.com
|
150
|
-
|
151
|
-
Does your project or organization use this gem? Add it to the showcase page.
|
152
|
-
https://github.com/forgecrafted/finishing_moves/wiki/showcase
|
153
|
-
|
154
|
-
********************************************************************************
|
143
|
+
post_install_message:
|
155
144
|
rdoc_options: []
|
156
145
|
require_paths:
|
157
146
|
- lib
|