natural_number_string 0.3.1 → 1.0.0

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: 558a4c943d3c6c6e40dcc8498c4b989cf781acfc
4
- data.tar.gz: bc1d1f75537a0e95f78810e562d41834b709e90d
3
+ metadata.gz: 7e0504b7f544a6843459856190216f8d1e0a5477
4
+ data.tar.gz: cd9fc346e86d669293020d477e43a4ad328b1df9
5
5
  SHA512:
6
- metadata.gz: 2af6dc71c6f4c2fd87feb89eacb362b443b92fd078eabaf9337727429bfbfe3d04e8f612deffbd843f07f87c620d126d555fb6480d6c19f4d864317d0fa0749e
7
- data.tar.gz: 4a4f57132abb386b4614b588f85c2d78cfeeaa343d90840765cdb593e354ac0766f982ecfd23f531cd2fa2ae4f2cb43499a55a28ee4faf2931e25abe5d608df5
6
+ metadata.gz: 51b0b489d8e8eca0bcb729117e4ef2aa6b2741b951dc4cde5ed72d9290eaa8285240cc57c889d44a09414ee81c86b883e264c12e36da17e94c630b4ae1f13d70
7
+ data.tar.gz: 791504ff2664cab2933482efc91df4d3d549c4d912c98f2a87d7c2cdb8386c8ed7d06b5849a24197dd1bd8fcc68f951d60e7317ec94b5cf89d0dba2ff7e28c20
data/Gemfile CHANGED
@@ -3,8 +3,7 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in natural_number_string.gemspec
4
4
  gemspec
5
5
 
6
- group :development do
7
- gem 'rubocop', group: :test
8
- gem 'byebug', group: :test if RUBY_VERSION >= '2.0.0'
9
- gem 'parse_gemspec-cli'
10
- end
6
+ gem 'rubocop'
7
+ gem 'byebug' if RUBY_VERSION >= '2.0.0'
8
+ gem 'parse_gemspec-cli'
9
+ gem 'yard'
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # NaturalNumberString
2
2
 
3
- [![Gem version][gem-image]][gem-url] [![Travis-CI Status][travis-image]][travis-url]
3
+ [![Gem version][gem-image]][gem-url] [![Travis-CI Status][travis-image]][travis-url] [![yard docs][docs-image]][docs-url]
4
4
 
5
5
  > Check the string is a natural number.
6
6
 
@@ -59,6 +59,8 @@ value.
59
59
  value.
60
60
 
61
61
 
62
+ And [details][docs-url].
63
+
62
64
  ## Changelog
63
65
 
64
66
  [changelog.md](./changelog.md).
@@ -103,3 +105,5 @@ The gem is available as open source under the terms of the [MIT License](http://
103
105
  [travis-image]: https://img.shields.io/travis/packsaddle/ruby-natural_number_string/master.svg?style=flat-square&label=build%20%28linux%29
104
106
  [gem-url]: https://rubygems.org/gems/natural_number_string
105
107
  [gem-image]: http://img.shields.io/gem/v/natural_number_string.svg?style=flat-square
108
+ [docs-url]: http://www.rubydoc.info/gems/natural_number_string
109
+ [docs-image]: https://img.shields.io/badge/yard-docs-blue.svg?style=flat-square
data/Rakefile CHANGED
@@ -7,3 +7,12 @@ Rake::TestTask.new(:test) do |t|
7
7
  end
8
8
 
9
9
  task default: :test
10
+
11
+ require 'yard'
12
+ require 'yard/rake/yardoc_task'
13
+ DOC_FILES = ['lib/**/*.rb']
14
+ DOC_OPTIONS = ['--debug', '--verbose']
15
+ YARD::Rake::YardocTask.new(:doc) do |t|
16
+ t.files = DOC_FILES
17
+ t.options = DOC_OPTIONS if Rake.application.options.trace
18
+ end
@@ -1,3 +1,9 @@
1
+ <a name="1.0.0"></a>
2
+ # [1.0.0](https://github.com/packsaddle/ruby-natural_number_string/compare/v0.3.1...v1.0.0) (2015-09-27)
3
+
4
+ Add yard document.
5
+
6
+
1
7
  <a name="0.3.1"></a>
2
8
  ## [0.3.1](https://github.com/packsaddle/ruby-natural_number_string/compare/v0.3.0...v0.3.1) (2015-09-26)
3
9
 
@@ -3,10 +3,67 @@ require 'natural_number_string/version'
3
3
  module NaturalNumberString
4
4
  module_function
5
5
 
6
+ # Check the string is a positive integer or zero
7
+ # @param value [Object] any object
8
+ # @return [Boolean] the string is a positive integer or zero
9
+ # @example Use include
10
+ # class Example
11
+ # include NaturalNumberString
12
+ # def example
13
+ # zero_or_positive_integer_string?('1') #=> true
14
+ # zero_or_positive_integer_string?('100000000000000') #=> true
15
+ # zero_or_positive_integer_string?('0') #=> true
16
+ #
17
+ # zero_or_positive_integer_string?(nil) #=> false
18
+ # zero_or_positive_integer_string?('') #=> false
19
+ # zero_or_positive_integer_string?(1) #=> false
20
+ # zero_or_positive_integer_string?('1.1') #=> false
21
+ # zero_or_positive_integer_string?('-1') #=> false
22
+ # end
23
+ # end
24
+ # @example Use direct
25
+ # NaturalNumberString.zero_or_positive_integer_string?('1') #=> true
26
+ # NaturalNumberString
27
+ # .zero_or_positive_integer_string?('100000000000') #=> true
28
+ # NaturalNumberString.zero_or_positive_integer_string?('0') #=> true
29
+ #
30
+ # NaturalNumberString.zero_or_positive_integer_string?(nil) #=> false
31
+ # NaturalNumberString.zero_or_positive_integer_string?('') #=> false
32
+ # NaturalNumberString.zero_or_positive_integer_string?(1) #=> false
33
+ # NaturalNumberString.zero_or_positive_integer_string?('1.1') #=> false
34
+ # NaturalNumberString.zero_or_positive_integer_string?('-1') #=> false
6
35
  def zero_or_positive_integer_string?(value)
7
36
  value.is_a?(String) && /^\d+$/ =~ value ? true : false
8
37
  end
9
38
 
39
+ # Check the string is a positive integer
40
+ # @param value [Object] any object
41
+ # @return [Boolean] the string is a positive integer
42
+ # @example Use include
43
+ # class Example
44
+ # include NaturalNumberString
45
+ # def example
46
+ # positive_integer_string?('1') #=> true
47
+ # positive_integer_string?('100000000000000') #=> true
48
+ #
49
+ # positive_integer_string?(nil) #=> false
50
+ # positive_integer_string?('') #=> false
51
+ # positive_integer_string?(1) #=> false
52
+ # positive_integer_string?('1.1') #=> false
53
+ # positive_integer_string?('-1') #=> false
54
+ # positive_integer_string?('0') #=> false
55
+ # end
56
+ # end
57
+ # @example Use direct
58
+ # NaturalNumberString.positive_integer_string?('1') #=> true
59
+ # NaturalNumberString.positive_integer_string?('100000000000') #=> true
60
+ #
61
+ # NaturalNumberString.positive_integer_string?(nil) #=> false
62
+ # NaturalNumberString.positive_integer_string?('') #=> false
63
+ # NaturalNumberString.positive_integer_string?(1) #=> false
64
+ # NaturalNumberString.positive_integer_string?('1.1') #=> false
65
+ # NaturalNumberString.positive_integer_string?('-1') #=> false
66
+ # NaturalNumberString.positive_integer_string?('0') #=> false
10
67
  def positive_integer_string?(value)
11
68
  value.is_a?(String) && /^[1-9]\d*$/ =~ value ? true : false
12
69
  end
@@ -1,3 +1,3 @@
1
1
  module NaturalNumberString
2
- VERSION = '0.3.1'
2
+ VERSION = '1.0.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: natural_number_string
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sanemat
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-26 00:00:00.000000000 Z
11
+ date: 2015-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -103,3 +103,4 @@ signing_key:
103
103
  specification_version: 4
104
104
  summary: Check the string is a natural number.
105
105
  test_files: []
106
+ has_rdoc: