kpietrzk_palindrome 0.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 +7 -0
- data/.gitignore +8 -0
- data/.idea/.gitignore +8 -0
- data/.idea/kpietrzk_palindrome.iml +22 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.travis.yml +6 -0
- data/Gemfile +10 -0
- data/README.md +46 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/kpietrzk_palindrome.gemspec +30 -0
- data/lib/kpietrzk_palindrome.rb +24 -0
- data/lib/kpietrzk_palindrome/version.rb +3 -0
- metadata +61 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b014b077381e95c8993411221688ec6888cf288b463f83542b7f21102d36204c
|
4
|
+
data.tar.gz: 7a339d063e687caa7c64e5cf44e989afd128fff3ebc4a9b2e5e66c02bdd65a90
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 17bd97ae0114ba6b604ddc7da32747d2195c804663082fba72ff883b2f6111d108d6423a68ea4ebcbacfb9a101a607b57f5a777b4ff0af8b97d29645fbe2fda4
|
7
|
+
data.tar.gz: eb27df1fc66ad9c182effef9d83cadcfd266cc5ceb81a07b54c98337fcf330f0645b675cd3e1b3205f183be3a18309d2a2294906c6cfe7e51736f9094910f239
|
data/.gitignore
ADDED
data/.idea/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$">
|
8
|
+
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
9
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
10
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
|
+
</content>
|
12
|
+
<orderEntry type="inheritedJdk" />
|
13
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="ansi (v1.5.0, rbenv: 2.7.1) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.4, rbenv: 2.7.1) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, rbenv: 2.7.1) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.14.1, rbenv: 2.7.1) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest-reporters (v1.2.0, rbenv: 2.7.1) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v12.3.3, rbenv: 2.7.1) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.10.1, rbenv: 2.7.1) [gem]" level="application" />
|
21
|
+
</component>
|
22
|
+
</module>
|
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/kpietrzk_palindrome.iml" filepath="$PROJECT_DIR$/.idea/kpietrzk_palindrome.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Palindrome detector
|
2
|
+
|
3
|
+
`kpietrzyk_palindrome` is a simple Ruby gem created in [Learn Enough to Be Dangerous](https://www.learnenough.com/) by Michael Hartl.
|
4
|
+
|
5
|
+
### Installation
|
6
|
+
To Install `kpietrzyk_palindrome`, add this line to your application's Gemfile:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
gem 'kpietrzyk_palindrome'
|
10
|
+
```
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
Then install as follows:
|
15
|
+
```bash
|
16
|
+
$ bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
Or install it directly using `gem`:
|
22
|
+
```bash
|
23
|
+
$ gem install kpietrzyk_palindrome
|
24
|
+
```
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
`kpietrzyk_palindrome` adds a `palindrome?` method to the `String` class, and can be used as follows:
|
29
|
+
|
30
|
+
```
|
31
|
+
$ irb
|
32
|
+
>> require 'kpietrzyk_palindrome'
|
33
|
+
>> "honey badger".palindrome?
|
34
|
+
=> false
|
35
|
+
>> "deified".palindrome?
|
36
|
+
=> true
|
37
|
+
>> "Able was I, ere I saw Elba.".palindrome?
|
38
|
+
=> true
|
39
|
+
>> phrase = "Madam, I'm Adam."
|
40
|
+
>> phrase.palindrome?
|
41
|
+
=> true
|
42
|
+
```
|
43
|
+
|
44
|
+
## License
|
45
|
+
|
46
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "kpietrzk_palindrome"
|
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
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/kpietrzk_palindrome/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'kpietrzk_palindrome'
|
7
|
+
spec.version = KpietrzkPalindrome::VERSION
|
8
|
+
spec.authors = ['kpietrzyk']
|
9
|
+
spec.email = ['krzysztof.pietrzyk@hotmail.com']
|
10
|
+
|
11
|
+
spec.summary = 'Palindrome detector'
|
12
|
+
spec.description = 'Learn Enough Ruby palindrome detector'
|
13
|
+
spec.homepage = 'https://github.com/kpietrzyk/my_first_ruby_gem'
|
14
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
15
|
+
|
16
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
|
17
|
+
|
18
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
+
spec.metadata['source_code_uri'] = 'https://github.com/kpietrzyk/my_first_ruby_gem'
|
20
|
+
spec.metadata['changelog_uri'] = 'https://github.com/kpietrzyk/my_first_ruby_gem'
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
25
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
end
|
27
|
+
spec.bindir = 'exe'
|
28
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ['lib']
|
30
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'kpietrzk_palindrome/version'
|
4
|
+
# Documentation comments
|
5
|
+
class String
|
6
|
+
# Returns true for a palindrome, false otherwise.
|
7
|
+
def palindrome?
|
8
|
+
processed_content == processed_content.reverse
|
9
|
+
end
|
10
|
+
|
11
|
+
# Returns the letters in the string.
|
12
|
+
def letters
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
# Returns content for palindrome testing.
|
19
|
+
def processed_content
|
20
|
+
scan(/[a-z]/i).join('').downcase
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kpietrzk_palindrome
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- kpietrzyk
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-08-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Learn Enough Ruby palindrome detector
|
14
|
+
email:
|
15
|
+
- krzysztof.pietrzyk@hotmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- ".idea/.gitignore"
|
22
|
+
- ".idea/kpietrzk_palindrome.iml"
|
23
|
+
- ".idea/misc.xml"
|
24
|
+
- ".idea/modules.xml"
|
25
|
+
- ".idea/vcs.xml"
|
26
|
+
- ".travis.yml"
|
27
|
+
- Gemfile
|
28
|
+
- README.md
|
29
|
+
- Rakefile
|
30
|
+
- bin/console
|
31
|
+
- bin/setup
|
32
|
+
- kpietrzk_palindrome.gemspec
|
33
|
+
- lib/kpietrzk_palindrome.rb
|
34
|
+
- lib/kpietrzk_palindrome/version.rb
|
35
|
+
homepage: https://github.com/kpietrzyk/my_first_ruby_gem
|
36
|
+
licenses: []
|
37
|
+
metadata:
|
38
|
+
allowed_push_host: https://rubygems.org/
|
39
|
+
homepage_uri: https://github.com/kpietrzyk/my_first_ruby_gem
|
40
|
+
source_code_uri: https://github.com/kpietrzyk/my_first_ruby_gem
|
41
|
+
changelog_uri: https://github.com/kpietrzyk/my_first_ruby_gem
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options: []
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 2.3.0
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
requirements: []
|
57
|
+
rubygems_version: 3.1.2
|
58
|
+
signing_key:
|
59
|
+
specification_version: 4
|
60
|
+
summary: Palindrome detector
|
61
|
+
test_files: []
|