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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 663ea844d4ce703ad30d1b688a8db8bec1a14f1f
4
- data.tar.gz: c04a4507343e7386f3c151c3a38771200ef125e8
3
+ metadata.gz: 866fccad1318171c982abbbfa77150f2df07cae9
4
+ data.tar.gz: 8fca63c081718015c790a23e6f4c5a31c3b8c34c
5
5
  SHA512:
6
- metadata.gz: 13fa03324b6935da4d7050cc617508950f41a7df961c61612aa98cf78362d8c5bbd295b2c5e1e08ee4622379c1f1e69f6f5f144a730b1f4a0ad43c421e993ff9
7
- data.tar.gz: b9fc9b0b62ac7857f5007715cae814a7f6f03f2f492a25286e7a5d2d23993228b2e6f4dfe6417a981919bfb45eac2a9a6641490a00dbe8023f9ae4082810108c
6
+ metadata.gz: 2bc558724c3c8be629cad4657abc66629e6bd6004b892b29c3263ab4b7ce385eee6436ea67212a42cdfcf07233feb39d0984d5e63f94af6651092fd79effe0d0
7
+ data.tar.gz: 65e3f054b09fc2dffc6088e25129b4471024cbd1b6e5fce1d2e672db8209ce5ec72417a2d8ea44ddec32ed985d955334605b2265a369275e53f822fc866fdf6a
@@ -8,6 +8,7 @@ rvm:
8
8
  - 2.2.0
9
9
  - 2.2.1
10
10
  - 2.2.2
11
+ - 2.3.0
11
12
  - ruby-head
12
13
 
13
14
  script: bundle exec rspec spec
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module FinishingMoves
2
- VERSION = "0.8"
2
+ VERSION = "0.9"
3
3
  end
@@ -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.8'
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-03-22 00:00:00.000000000 Z
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