gabyse_palindrome_detector 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 309555c5d95240b7598ff8a562b2bfafca25a9fdb7bd9848d3ce96a4cf761e11
4
+ data.tar.gz: 15971cab4457944cc07bd06b32798499ad2b6a8812c1d8e32cf91d1172ab2e63
5
+ SHA512:
6
+ metadata.gz: 3d4df5f67f38f53f5faae1350c32dcb202b5ceac86b6fc281b09c5d91e23fcc738590223c3e4560f97d638179f106f9f5af32c1f1aafc584eb55b9ee700200dd
7
+ data.tar.gz: 4eaa8351bb61e779963e58d62b133806a15844a7182a07bc6270540ca94773a9fd3686335c1aee15dc0cefa31b8146186949b6adf886a537be7d19332b81a73f
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-10-20
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in gabyse_palindrome_detector.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
11
+
12
+ gem "minitest-reporters", "~> 1.5"
13
+
14
+ gem "rubocop", "~> 1.21"
data/Gemfile.lock ADDED
@@ -0,0 +1,53 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gabyse_palindrome_detector (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ansi (1.5.0)
10
+ ast (2.4.2)
11
+ builder (3.2.4)
12
+ json (2.6.2)
13
+ minitest (5.16.3)
14
+ minitest-reporters (1.5.0)
15
+ ansi
16
+ builder
17
+ minitest (>= 5.0)
18
+ ruby-progressbar
19
+ parallel (1.22.1)
20
+ parser (3.1.2.1)
21
+ ast (~> 2.4.1)
22
+ rainbow (3.1.1)
23
+ rake (13.0.6)
24
+ regexp_parser (2.6.0)
25
+ rexml (3.2.5)
26
+ rubocop (1.36.0)
27
+ json (~> 2.3)
28
+ parallel (~> 1.10)
29
+ parser (>= 3.1.2.1)
30
+ rainbow (>= 2.2.2, < 4.0)
31
+ regexp_parser (>= 1.8, < 3.0)
32
+ rexml (>= 3.2.5, < 4.0)
33
+ rubocop-ast (>= 1.20.1, < 2.0)
34
+ ruby-progressbar (~> 1.7)
35
+ unicode-display_width (>= 1.4.0, < 3.0)
36
+ rubocop-ast (1.22.0)
37
+ parser (>= 3.1.1.0)
38
+ ruby-progressbar (1.11.0)
39
+ unicode-display_width (2.3.0)
40
+
41
+ PLATFORMS
42
+ x86_64-linux
43
+
44
+ DEPENDENCIES
45
+ bundler (~> 2.3, >= 2.3.24)
46
+ gabyse_palindrome_detector!
47
+ minitest (~> 5.0)
48
+ minitest-reporters (~> 1.5)
49
+ rake (~> 13.0)
50
+ rubocop (~> 1.21)
51
+
52
+ BUNDLED WITH
53
+ 2.3.24
data/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # GabysePalindrome detector
2
+
3
+ `gabyse_palindrome_detector` is a sample Ruby gem created in [*Learn Enough Ruby to Be Dangerous*](https://www.learnenough.com/ruby-tutorial) by Michael Hartl.
4
+
5
+ ## Installation
6
+
7
+ To install `gabyse_palindrome_detector`, add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'gabyse_palindrome_detector'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install gabyse_palindrome_detector -v 0.1.0
20
+
21
+ ## Usage
22
+
23
+ `gabyse_palindrome_detector` adds a `palindrome?` method to the `String` and `Integer` classes, and can be used as follows:
24
+
25
+ ```
26
+ $ irb
27
+ >> require 'gabyse_palindrome_detector'
28
+ >> "honey badger".palindrome?
29
+ => false
30
+ >> "deified".palindrome?
31
+ => true
32
+ >> "Able was I, ere I saw Elba.".palindrome?
33
+ => true
34
+ >> phrase = "Madam, I'm Adam."
35
+ >> phrase.palindrome?
36
+ => true
37
+ >> "".palindrome?
38
+ => false
39
+ >> 12321.palindrome?
40
+ => true
41
+ >> 12345.palindrome?
42
+ => false
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/gabyse1/gabyse_palindrome_detector.
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/test_*.rb"]
10
+ end
11
+
12
+ require "rubocop/rake_task"
13
+
14
+ RuboCop::RakeTask.new
15
+
16
+ task default: %i[test rubocop]
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/gabyse_palindrome_detector/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "gabyse_palindrome_detector"
7
+ spec.version = GabysePalindromeDetector::VERSION
8
+ spec.authors = ["Gaby"]
9
+ spec.email = ["gaby.es.sd@gmail.com"]
10
+
11
+ spec.summary = "Palindrome detector"
12
+ spec.description = "Ruby palindrome detector for strings and integers."
13
+ spec.homepage = "https://github.com/gabyse1/gabyse_palindrome_detector"
14
+ spec.required_ruby_version = ">= 2.6.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"] = spec.homepage
20
+ spec.metadata["changelog_uri"] = spec.homepage
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(__dir__) do
25
+ `git ls-files -z`.split("\x0").reject do |f|
26
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
27
+ end
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ # Uncomment to register a new dependency of your gem
34
+ # spec.add_dependency "example-gem", "~> 1.0"
35
+ spec.add_development_dependency "bundler", "~> 2.3", ">= 2.3.24"
36
+
37
+ # For more information and examples about making a new gem, check out our
38
+ # guide at: https://bundler.io/guides/creating_gem.html
39
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GabysePalindromeDetector
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "gabyse_palindrome_detector/version"
4
+
5
+ # Module to modularize the palindrome detector
6
+ module GabysePalindromeDetector
7
+ def palindrome?
8
+ if processed_content.empty?
9
+ false
10
+ else
11
+ processed_content == processed_content.reverse
12
+ end
13
+ end
14
+
15
+ private
16
+
17
+ def processed_content
18
+ to_s.scan(/[\w\d]+/).join.downcase
19
+ end
20
+ end
21
+
22
+ # Adding palindrome method to the String class
23
+ class String
24
+ include GabysePalindromeDetector
25
+ end
26
+
27
+ # Adding palindrome method to the Integer class
28
+ class Integer
29
+ include GabysePalindromeDetector
30
+ end
@@ -0,0 +1,4 @@
1
+ module GabysePalindromeDetector
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gabyse_palindrome_detector
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gaby
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-10-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.3'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.3.24
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.3'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.3.24
33
+ description: Ruby palindrome detector for strings and integers.
34
+ email:
35
+ - gaby.es.sd@gmail.com
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - ".rubocop.yml"
41
+ - CHANGELOG.md
42
+ - Gemfile
43
+ - Gemfile.lock
44
+ - README.md
45
+ - Rakefile
46
+ - gabyse_palindrome_detector.gemspec
47
+ - lib/gabyse_palindrome_detector.rb
48
+ - lib/gabyse_palindrome_detector/version.rb
49
+ - sig/gabyse_palindrome_detector.rbs
50
+ homepage: https://github.com/gabyse1/gabyse_palindrome_detector
51
+ licenses: []
52
+ metadata:
53
+ allowed_push_host: https://rubygems.org/
54
+ homepage_uri: https://github.com/gabyse1/gabyse_palindrome_detector
55
+ source_code_uri: https://github.com/gabyse1/gabyse_palindrome_detector
56
+ changelog_uri: https://github.com/gabyse1/gabyse_palindrome_detector
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 2.6.0
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubygems_version: 3.1.2
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: Palindrome detector
76
+ test_files: []