natural_number_string 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/changelog.md +6 -0
- data/lib/natural_number_string.rb +14 -7
- data/lib/natural_number_string/version.rb +1 -1
- data/natural_number_string.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 794410e84801782b922ed534cddddfcfe65ee754
|
4
|
+
data.tar.gz: a68fe413f6bd6c609d730f7dd0980815a20ec296
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6eefe5486dde09bf569275c22e69d18762fc1f82f412f7ed892e2b2dc2fc88ed41225cbf93816e0694ed35cdc648dbbd714275b040e48c6896b8bd1eba1a0fb
|
7
|
+
data.tar.gz: 95cdc578ce66af7625266d1c3937f4c9d0a1dbd77a22a9d0460ad2877e04ad7911ad23ec0e6f9a42798c4128fe7bf14c100b9860525e669fc57d4d8264b69dc0
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Gem version][gem-image]][gem-url] [![Travis-CI Status][travis-image]][travis-url] [![yard docs][docs-image]][docs-url]
|
4
4
|
|
5
|
-
> Check the
|
5
|
+
> Check the value is string of natural number.
|
6
6
|
|
7
7
|
|
8
8
|
## Usage
|
@@ -47,7 +47,7 @@ NaturalNumberString.positive_integer_string?('0') #=> false
|
|
47
47
|
|
48
48
|
*Required*
|
49
49
|
|
50
|
-
|
50
|
+
Any Object.
|
51
51
|
|
52
52
|
|
53
53
|
### NaturalNumberString.zero_or_positive_integer_string?(value) -> boolean
|
@@ -56,10 +56,11 @@ value.
|
|
56
56
|
|
57
57
|
*Required*
|
58
58
|
|
59
|
-
|
59
|
+
Any Object.
|
60
60
|
|
61
61
|
|
62
|
-
And [details][docs-url].
|
62
|
+
And more [details][docs-url].
|
63
|
+
|
63
64
|
|
64
65
|
## Changelog
|
65
66
|
|
data/changelog.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
<a name="1.0.1"></a>
|
2
|
+
## [1.0.1](https://github.com/packsaddle/ruby-natural_number_string/compare/v1.0.0...v1.0.1) (2015-09-27)
|
3
|
+
|
4
|
+
Improve document.
|
5
|
+
|
6
|
+
|
1
7
|
<a name="1.0.0"></a>
|
2
8
|
# [1.0.0](https://github.com/packsaddle/ruby-natural_number_string/compare/v0.3.1...v1.0.0) (2015-09-27)
|
3
9
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'natural_number_string/version'
|
2
2
|
|
3
|
+
# Check the value is string of natural number.
|
3
4
|
module NaturalNumberString
|
4
5
|
module_function
|
5
6
|
|
6
|
-
# Check the
|
7
|
-
#
|
8
|
-
# @return [Boolean] the string is a positive integer or zero
|
7
|
+
# Check the value is string of positive integer or zero
|
8
|
+
#
|
9
9
|
# @example Use include
|
10
10
|
# class Example
|
11
11
|
# include NaturalNumberString
|
@@ -21,10 +21,11 @@ module NaturalNumberString
|
|
21
21
|
# zero_or_positive_integer_string?('-1') #=> false
|
22
22
|
# end
|
23
23
|
# end
|
24
|
+
#
|
24
25
|
# @example Use direct
|
25
26
|
# NaturalNumberString.zero_or_positive_integer_string?('1') #=> true
|
26
27
|
# NaturalNumberString
|
27
|
-
#
|
28
|
+
# .zero_or_positive_integer_string?('100000000000') #=> true
|
28
29
|
# NaturalNumberString.zero_or_positive_integer_string?('0') #=> true
|
29
30
|
#
|
30
31
|
# NaturalNumberString.zero_or_positive_integer_string?(nil) #=> false
|
@@ -32,13 +33,15 @@ module NaturalNumberString
|
|
32
33
|
# NaturalNumberString.zero_or_positive_integer_string?(1) #=> false
|
33
34
|
# NaturalNumberString.zero_or_positive_integer_string?('1.1') #=> false
|
34
35
|
# NaturalNumberString.zero_or_positive_integer_string?('-1') #=> false
|
36
|
+
#
|
37
|
+
# @param value [Object] any object
|
38
|
+
# @return [Boolean] the value is string of positive integer or zero
|
35
39
|
def zero_or_positive_integer_string?(value)
|
36
40
|
value.is_a?(String) && /^\d+$/ =~ value ? true : false
|
37
41
|
end
|
38
42
|
|
39
|
-
# Check the
|
40
|
-
#
|
41
|
-
# @return [Boolean] the string is a positive integer
|
43
|
+
# Check the value is string of positive integer
|
44
|
+
#
|
42
45
|
# @example Use include
|
43
46
|
# class Example
|
44
47
|
# include NaturalNumberString
|
@@ -54,6 +57,7 @@ module NaturalNumberString
|
|
54
57
|
# positive_integer_string?('0') #=> false
|
55
58
|
# end
|
56
59
|
# end
|
60
|
+
#
|
57
61
|
# @example Use direct
|
58
62
|
# NaturalNumberString.positive_integer_string?('1') #=> true
|
59
63
|
# NaturalNumberString.positive_integer_string?('100000000000') #=> true
|
@@ -64,6 +68,9 @@ module NaturalNumberString
|
|
64
68
|
# NaturalNumberString.positive_integer_string?('1.1') #=> false
|
65
69
|
# NaturalNumberString.positive_integer_string?('-1') #=> false
|
66
70
|
# NaturalNumberString.positive_integer_string?('0') #=> false
|
71
|
+
#
|
72
|
+
# @param value [Object] any object
|
73
|
+
# @return [Boolean] the value is string of positive integer
|
67
74
|
def positive_integer_string?(value)
|
68
75
|
value.is_a?(String) && /^[1-9]\d*$/ =~ value ? true : false
|
69
76
|
end
|
@@ -10,9 +10,9 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['o.gata.ken@gmail.com']
|
11
11
|
|
12
12
|
spec.summary =
|
13
|
-
'Check the
|
13
|
+
'Check the value is string of natural number.'
|
14
14
|
spec.description =
|
15
|
-
'Check the
|
15
|
+
'Check the value is string of natural number.'
|
16
16
|
spec.homepage =
|
17
17
|
'https://github.com/packsaddle/ruby-natural_number_string'
|
18
18
|
spec.license = 'MIT'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: natural_number_string
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sanemat
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description: Check the
|
55
|
+
description: Check the value is string of natural number.
|
56
56
|
email:
|
57
57
|
- o.gata.ken@gmail.com
|
58
58
|
executables: []
|
@@ -101,6 +101,6 @@ rubyforge_project:
|
|
101
101
|
rubygems_version: 2.4.5
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
|
-
summary: Check the
|
104
|
+
summary: Check the value is string of natural number.
|
105
105
|
test_files: []
|
106
106
|
has_rdoc:
|