fat_core 0.3.2 → 0.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6f6c39f5b95fa82106fa81bc15d47215278bd2c
4
- data.tar.gz: e7632c72d551764454aaeec737d71d18847fe4bf
3
+ metadata.gz: f8c6840ffea69ed122686854e4280bc17ffb9e63
4
+ data.tar.gz: 4a34b1b56e565390e720e591e167ad43cc39bb32
5
5
  SHA512:
6
- metadata.gz: 94fd3a4063b66aaaa1c46f832c721077b5d698e7416933dfbb275bec8644b5c865990294ac3d41efa89ff8d77c4d1daa0e5e8c965e257eeab5175e2ece736012
7
- data.tar.gz: 16c302bd19b48aaf79c1ff2ff6f183523665265ee7763e1f7e2541c16db8023bb4bebd4ff9488b99979e179172353e7e64cfaf16c212a3d3ee4b16de27ae6128
6
+ metadata.gz: 9e2def4f428339f99e12872a258f16e3880f7b2948231007c824631061b442766d91f75d4d476fc9becc717891a12546761cf6a27781f86db3607b3c58060a6a
7
+ data.tar.gz: 984d25b5d460af3c5a1fbfbec54ced7302cab056130550ac515b149971ea2d013ebdf4c1a50288b59830ba3abcba13761efa3b73e75ba85b033a1b8ad91486ef
@@ -81,6 +81,13 @@ class String
81
81
  self
82
82
  end
83
83
 
84
+ def number?
85
+ Float(self)
86
+ true
87
+ rescue ArgumentError
88
+ return false
89
+ end
90
+
84
91
  def wrap(width=70, hang=0)
85
92
  offset = 0
86
93
  trip = 1
@@ -1,7 +1,7 @@
1
1
  module FatCore
2
2
  MAJOR = 0
3
- MINOR = 3
4
- PATCH = 2
3
+ MINOR = 4
4
+ PATCH = 0
5
5
 
6
6
  VERSION = [MAJOR, MINOR, PATCH].compact.join('.')
7
7
  end
@@ -96,6 +96,17 @@ the people, for the people, shall not perish from the earth."
96
96
  expect("{hello}".tex_quote).to eq("\\{hello\\}")
97
97
  end
98
98
 
99
+ it "should be able to determine is it's a valid number" do
100
+ expect('88'.number?).to be true
101
+ expect('-88'.number?).to be true
102
+ expect('8.008'.number?).to be true
103
+ expect('-8.008'.number?).to be true
104
+ expect('8.008e33'.number?).to be true
105
+ expect('-8.008e33'.number?).to be true
106
+ expect('0x8.008'.number?).to be false
107
+ expect('hello world'.number?).to be false
108
+ end
109
+
99
110
  it "should be able to convert a string to a regular expression" do
100
111
  re = "/hello((\s+)(world))?/".to_regexp
101
112
  expect(re.class).to eq Regexp
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fat_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel E. Doherty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-17 00:00:00.000000000 Z
11
+ date: 2015-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov