palenque 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/README.md +14 -3
- data/Rakefile +6 -0
- data/lib/palenque/version.rb +1 -1
- data/lib/palenque.rb +6 -2
- data/palenque.gemspec +3 -2
- data/spec/palenque_spec.rb +19 -12
- metadata +19 -4
- data/LICENSE.txt +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df51a2868e8b8155f5a3659b132b08520fe3e4de
|
4
|
+
data.tar.gz: a1ff75df187d2ef1aa0253a6b9e9f72f1f121e2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61a335146fb8d0dccf6213192259c7665ae95bb84e4cc64aa7ef6634782f616898fb1f4084f5d7d06159639a10416de30180aa84c305ff222643787488f8987f
|
7
|
+
data.tar.gz: f501f48cde86077e0c37c147e9bef829fdebe62b569f51ed7c8286acb22ed7c01ffb439d6cbaa44d688a3a3b7f4efcd6e1e1ad1d365c6fb6f4a9f827b982b062
|
data/.rspec
ADDED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Palenque
|
2
2
|
|
3
|
-
|
3
|
+
Tiny library to check is an Integer or String is palindrome.
|
4
|
+
|
5
|
+
This was done as part of a short presentation at the [Bogota Ruby Meetup](http://www.meetup.com/bogota-ruby-meetup/events/153932032/) about creating Ruby Gems, slides are [here](https://speakerdeck.com/sebasoga/building-a-ruby-gem).
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
@@ -19,8 +21,13 @@ Or install it yourself as:
|
|
19
21
|
## Usage
|
20
22
|
|
21
23
|
````ruby
|
22
|
-
Palenque.palindrome?('
|
23
|
-
Palenque.palindrome?(
|
24
|
+
Palenque.palindrome?('Radar') # => true
|
25
|
+
Palenque.palindrome?(45654) # => true
|
26
|
+
|
27
|
+
# It receives any type of object
|
28
|
+
Palenque.palindrome?('meetup') # => false
|
29
|
+
Palenque.palindrome?([1, 2, 3]) # => false
|
30
|
+
Palenque.palindrome?(nil) # => false
|
24
31
|
````
|
25
32
|
|
26
33
|
## Contributing
|
@@ -30,3 +37,7 @@ Palenque.palindrome?([1, 2, 3] ) # => false
|
|
30
37
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
31
38
|
4. Push to the branch (`git push origin my-new-feature`)
|
32
39
|
5. Create new Pull Request
|
40
|
+
|
41
|
+
## LICENSE
|
42
|
+
|
43
|
+
See [LICENSE](https://github.com/sebasoga/palenque/blob/master/LICENSE.md) for details.
|
data/Rakefile
CHANGED
data/lib/palenque/version.rb
CHANGED
data/lib/palenque.rb
CHANGED
data/palenque.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Palenque::VERSION
|
9
9
|
spec.authors = ["Sebastian Sogamoso"]
|
10
10
|
spec.email = ["sebasoga@gmail.com"]
|
11
|
-
spec.description = %q{Checks if an
|
12
|
-
spec.summary = %q{
|
11
|
+
spec.description = %q{Checks if an Integer or a Stting object is palindrome}
|
12
|
+
spec.summary = %q{Recevies any object, if the object is an Integer or a String it checks whether it is palindrome or not }
|
13
13
|
spec.homepage = "https://github.com/sebasoga/palenque"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec", "~> 2.14"
|
23
24
|
end
|
data/spec/palenque_spec.rb
CHANGED
@@ -2,34 +2,41 @@ require 'palenque'
|
|
2
2
|
|
3
3
|
describe Palenque do
|
4
4
|
describe "#palindrome?" do
|
5
|
-
context "when the
|
5
|
+
context "when the argument is a String that's palindrome" do
|
6
6
|
it "returns true" do
|
7
|
-
expect(Palenque.palindrome?
|
7
|
+
expect(Palenque.palindrome? 'radar').to be_true
|
8
8
|
end
|
9
|
-
end
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
context "and has some capital letters" do
|
11
|
+
it "returns true" do
|
12
|
+
expect(Palenque.palindrome? 'DeLeveled').to be_true
|
13
|
+
end
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
context "when the argument is
|
17
|
+
context "when the argument is a String that's not palindrome" do
|
18
18
|
it "returns false" do
|
19
|
-
expect(Palenque.palindrome?
|
19
|
+
expect(Palenque.palindrome? 'palenque').to be_false
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
context "when the argument
|
23
|
+
context "when the argument is an Integer that's palindrome" do
|
24
24
|
it "returns true if the argument is palindrome" do
|
25
|
-
expect(Palenque.palindrome?
|
25
|
+
expect(Palenque.palindrome? 12321).to be_true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when the argument is an Integer that's not palindrome" do
|
30
|
+
it "returns false if the argument is palindrome" do
|
31
|
+
expect(Palenque.palindrome? 123).to be_false
|
26
32
|
end
|
27
33
|
end
|
28
34
|
end
|
29
35
|
|
30
|
-
context "when the argument
|
36
|
+
context "when the argument is not a String" do
|
31
37
|
it "returns false" do
|
32
|
-
|
38
|
+
expect(Palenque.palindrome? [1, 2, 3]).to be_false
|
39
|
+
expect(Palenque.palindrome? nil).to be_false
|
33
40
|
end
|
34
41
|
end
|
35
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: palenque
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Sogamoso
|
@@ -38,7 +38,21 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.14'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.14'
|
55
|
+
description: Checks if an Integer or a Stting object is palindrome
|
42
56
|
email:
|
43
57
|
- sebasoga@gmail.com
|
44
58
|
executables: []
|
@@ -46,10 +60,10 @@ extensions: []
|
|
46
60
|
extra_rdoc_files: []
|
47
61
|
files:
|
48
62
|
- .gitignore
|
63
|
+
- .rspec
|
49
64
|
- .ruby-version
|
50
65
|
- Gemfile
|
51
66
|
- LICENSE.md
|
52
|
-
- LICENSE.txt
|
53
67
|
- README.md
|
54
68
|
- Rakefile
|
55
69
|
- lib/palenque.rb
|
@@ -79,7 +93,8 @@ rubyforge_project:
|
|
79
93
|
rubygems_version: 2.1.11
|
80
94
|
signing_key:
|
81
95
|
specification_version: 4
|
82
|
-
summary:
|
96
|
+
summary: Recevies any object, if the object is an Integer or a String it checks whether
|
97
|
+
it is palindrome or not
|
83
98
|
test_files:
|
84
99
|
- spec/palenque_spec.rb
|
85
100
|
has_rdoc:
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2013 Sebastian Sogamoso
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|