is_numeric 1.0.0 → 1.1.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
- SHA1:
3
- metadata.gz: 21543f792b0c0bc2f35c4231af74f00c6c078e5e
4
- data.tar.gz: 1ec60ec4f2306a7d2838efa6fb75f63fb5a1b974
2
+ SHA256:
3
+ metadata.gz: 30c32502feffa754c39120cb7181c27410e2e2a5177e24179fcf700be4775a4d
4
+ data.tar.gz: e5eea5915b0cfa4b8e6b8624a47d65205ef09eec8ad84164ab44a1ac34bb2f78
5
5
  SHA512:
6
- metadata.gz: 33a19d18c858f27c9368bf52c89dc37229c753b0d0b939a352b11a1913b747b53b2ed71809884ebf2ecfd1ac99ffe2bded3b03661c2e44885a995d946f300644
7
- data.tar.gz: fa6dfa226c0f11147e32d3e59979dbb268907b970e0822a1bd44120121cf8c1dbf8d7b35dbbba0716fbeb6fa7f72cdefac76d7dc8d802606aaa36c4b22213ba5
6
+ metadata.gz: 0b14c185315a4f4e8bb5b3db5eb12c09608327fb5c44220afc445846544a112fc52d45d8ad5ba6171898249b138bb46462389f40378270448fb125da114fd8eb
7
+ data.tar.gz: 7580b063e8cabaf5291f5f9b97d62c8ba55f598b8240ba62d95247b34912fa1ba6719297726f68d94f384ef5a4480734ed6cffdb8a0fa83d75744254b43998d2
@@ -0,0 +1,47 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches: [ "master" ]
6
+ pull_request:
7
+ branches: [ "master" ]
8
+
9
+ jobs:
10
+ build:
11
+ name: Build + Publish
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: read
15
+ packages: write
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - name: Set up Ruby 2.6
20
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
21
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: 2.6.10
25
+
26
+ - name: Publish to GPR
27
+ run: |
28
+ mkdir -p $HOME/.gem
29
+ touch $HOME/.gem/credentials
30
+ chmod 0600 $HOME/.gem/credentials
31
+ printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
32
+ gem build *.gemspec
33
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
34
+ env:
35
+ GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
36
+ OWNER: ${{ github.repository_owner }}
37
+
38
+ - name: Publish to RubyGems
39
+ run: |
40
+ mkdir -p $HOME/.gem
41
+ touch $HOME/.gem/credentials
42
+ chmod 0600 $HOME/.gem/credentials
43
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
44
+ gem build *.gemspec
45
+ gem push *.gem
46
+ env:
47
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
data/.gitignore CHANGED
@@ -1,9 +1,10 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .idea
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.4.1
5
- before_install: gem install bundler -v 1.14.6
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler -v 1.14.6
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in is_numeric.gemspec
4
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in is_numeric.gemspec
4
+ gemspec
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2017 Daniel Kühl Lima
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Daniel Kühl Lima
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,57 +1,59 @@
1
- # is_numeric
2
-
3
- This gem just expand the String class to provide a method called 'numeric?' that verify if a string have a numeric value.
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'is_numeric'
11
- ```
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install is_numeric
20
-
21
- ## Usage
22
-
23
- ```
24
- [1] pry(main)> require 'is_numeric'
25
- => true
26
-
27
- [2] pry(main)> string1 = "Just a test"
28
- => "Just a test"
29
- [3] pry(main)> string1.numeric?
30
- => false
31
-
32
- [4] pry(main)> string2 = "10.1"
33
- => "10.1"
34
- [5] pry(main)> string2.numeric?
35
- => true
36
-
37
- [6] pry(main)> string3 = "1"
38
- => "1"
39
- [7] pry(main)> string3.numeric?
40
- => true
41
- ```
42
-
43
- ## Development
44
-
45
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
46
-
47
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
48
-
49
- ## Contributing
50
-
51
- Bug reports and pull requests are welcome on GitHub at https://github.com/dklima/is_numeric.
52
-
53
-
54
- ## License
55
-
56
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
57
-
1
+ [![Gem Version](https://badge.fury.io/rb/is_numeric.svg)](https://badge.fury.io/rb/is_numeric)
2
+
3
+ # is_numeric
4
+
5
+ This gem just expand the String class to provide a method called 'numeric?' that verify if a string have a numeric value.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'is_numeric'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install is_numeric
22
+
23
+ ## Usage
24
+
25
+ ```
26
+ [1] pry(main)> require 'is_numeric'
27
+ => true
28
+
29
+ [2] pry(main)> string1 = "Just a test"
30
+ => "Just a test"
31
+ [3] pry(main)> string1.numeric?
32
+ => false
33
+
34
+ [4] pry(main)> string2 = "10.1"
35
+ => "10.1"
36
+ [5] pry(main)> string2.numeric?
37
+ => true
38
+
39
+ [6] pry(main)> string3 = "1"
40
+ => "1"
41
+ [7] pry(main)> string3.numeric?
42
+ => true
43
+ ```
44
+
45
+ ## Development
46
+
47
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
+
49
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
50
+
51
+ ## Contributing
52
+
53
+ Bug reports and pull requests are welcome on GitHub at https://github.com/dklima/is_numeric.
54
+
55
+
56
+ ## License
57
+
58
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
59
+
data/Rakefile CHANGED
@@ -1,10 +1,9 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList['test/**/*_test.rb']
8
- end
9
-
10
- task :default => :test
1
+ require "rake/testtask"
2
+
3
+ Rake::TestTask.new(:test) do |t|
4
+ t.libs << "test"
5
+ t.test_files = FileList['test/**/*_test.rb']
6
+ t.verbose = true
7
+ end
8
+
9
+ task default: :test
data/bin/console CHANGED
@@ -1,14 +1,14 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "is_numeric"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "is_numeric"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/is_numeric.gemspec CHANGED
@@ -1,28 +1,28 @@
1
- # coding: utf-8
2
-
3
- lib = File.expand_path('../lib', __FILE__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'is_numeric/version'
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = 'is_numeric'
9
- spec.version = IsNumeric::VERSION
10
- spec.authors = ['Daniel K Lima']
11
- spec.email = ['dklima@gmail.com']
12
-
13
- spec.summary = %q{Expand String class to provide a verification if a string is numeric}
14
- spec.description = %q{Add the method 'numeric?' to String which will return true if the string have a numeric value}
15
- spec.homepage = 'https://github.com/dklima/is_numeric'
16
- spec.license = 'MIT'
17
-
18
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
- f.match(%r{^(test|spec|features)/})
20
- end
21
- spec.bindir = 'exe'
22
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
- spec.require_paths = ['lib']
24
-
25
- spec.add_development_dependency 'bundler', '~> 1.14'
26
- spec.add_development_dependency 'rake', '~> 10.0'
27
- spec.add_development_dependency 'minitest', '~> 5.0'
28
- end
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'is_numeric/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'is_numeric'
9
+ spec.version = IsNumeric::VERSION
10
+ spec.authors = ['Daniel K Lima']
11
+ spec.email = ['dklima@gmail.com']
12
+
13
+ spec.summary = %q{Expand String class to provide a verification if a string is numeric}
14
+ spec.description = %q{Add the method 'numeric?' to String which will return true if the string have a numeric value}
15
+ spec.homepage = 'https://github.com/dklima/is_numeric'
16
+ spec.license = 'MIT'
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
+ f.match(%r{^(test|spec|features)/})
20
+ end
21
+ spec.bindir = 'exe'
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_development_dependency 'bundler', '~> 2.6.0'
26
+ spec.add_development_dependency 'rake', '~> 13.2.1'
27
+ spec.add_development_dependency 'minitest', '~> 5.25', '>= 5.25.5'
28
+ end
@@ -1,3 +1,3 @@
1
- module IsNumeric
2
- VERSION = '1.0.0'.freeze
3
- end
1
+ module IsNumeric
2
+ VERSION = '1.1.0'.freeze
3
+ end
data/lib/is_numeric.rb CHANGED
@@ -1,9 +1,11 @@
1
- require 'is_numeric/version'
2
-
3
- # Extending the class String to perform checks on string to get
4
- # if is a number
5
- class String
6
- def numeric?
7
- !(self !~ /^-?\d+(\.\d*)?$/)
8
- end
9
- end
1
+ require 'is_numeric/version'
2
+
3
+ # Extending the class String to perform checks on string to get
4
+ # if is a number
5
+ module IsNumeric
6
+ def numeric?
7
+ !!Float(self) rescue false
8
+ end
9
+ end
10
+
11
+ String.include(IsNumeric)
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: is_numeric
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel K Lima
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2017-05-02 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -16,42 +15,48 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '1.14'
18
+ version: 2.6.0
20
19
  type: :development
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '1.14'
25
+ version: 2.6.0
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: rake
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - "~>"
32
31
  - !ruby/object:Gem::Version
33
- version: '10.0'
32
+ version: 13.2.1
34
33
  type: :development
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - "~>"
39
38
  - !ruby/object:Gem::Version
40
- version: '10.0'
39
+ version: 13.2.1
41
40
  - !ruby/object:Gem::Dependency
42
41
  name: minitest
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
44
  - - "~>"
46
45
  - !ruby/object:Gem::Version
47
- version: '5.0'
46
+ version: '5.25'
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 5.25.5
48
50
  type: :development
49
51
  prerelease: false
50
52
  version_requirements: !ruby/object:Gem::Requirement
51
53
  requirements:
52
54
  - - "~>"
53
55
  - !ruby/object:Gem::Version
54
- version: '5.0'
56
+ version: '5.25'
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 5.25.5
55
60
  description: Add the method 'numeric?' to String which will return true if the string
56
61
  have a numeric value
57
62
  email:
@@ -60,6 +65,7 @@ executables: []
60
65
  extensions: []
61
66
  extra_rdoc_files: []
62
67
  files:
68
+ - ".github/workflows/gem-push.yml"
63
69
  - ".gitignore"
64
70
  - ".travis.yml"
65
71
  - Gemfile
@@ -75,7 +81,6 @@ homepage: https://github.com/dklima/is_numeric
75
81
  licenses:
76
82
  - MIT
77
83
  metadata: {}
78
- post_install_message:
79
84
  rdoc_options: []
80
85
  require_paths:
81
86
  - lib
@@ -90,9 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
95
  - !ruby/object:Gem::Version
91
96
  version: '0'
92
97
  requirements: []
93
- rubyforge_project:
94
- rubygems_version: 2.6.11
95
- signing_key:
98
+ rubygems_version: 3.6.8
96
99
  specification_version: 4
97
100
  summary: Expand String class to provide a verification if a string is numeric
98
101
  test_files: []