lewwadoo_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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: aea774f7187131ecdf690ccb9c9ce58a4fc82e30df602ecab3ac1f0c2c8a5708
4
+ data.tar.gz: 8cfc29509f34b4aad6c3c7c2db367de1a24ccb32d358e3609c93879a0c35b3d3
5
+ SHA512:
6
+ metadata.gz: 06e4ffd297e70927237ef2f35f00a425e77e296e6b92e36ce6ca5e8d27274e21c3547ee7f9b4a37cd464f8dbdeb57f962b7af7db66579ecd05537a437203f59e
7
+ data.tar.gz: a215ef4f9b5a277dffbda51b88ef161590c4d72fd627a45a907884e06a9f999327a74f2ceda658f19a15afb669916fbb4ff6d9a7e8392d376f725140ea3d8854
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in lewwadoo_palindrome.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
11
+ gem 'minitest-reporters', '1.2.0'
data/Gemfile.lock ADDED
@@ -0,0 +1,30 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ lewwadoo_palindrome (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ansi (1.5.0)
10
+ builder (3.2.4)
11
+ minitest (5.15.0)
12
+ minitest-reporters (1.2.0)
13
+ ansi
14
+ builder
15
+ minitest (>= 5.0)
16
+ ruby-progressbar
17
+ rake (13.0.6)
18
+ ruby-progressbar (1.11.0)
19
+
20
+ PLATFORMS
21
+ x86_64-linux
22
+
23
+ DEPENDENCIES
24
+ lewwadoo_palindrome!
25
+ minitest (~> 5.0)
26
+ minitest-reporters (= 1.2.0)
27
+ rake (~> 13.0)
28
+
29
+ BUNDLED WITH
30
+ 2.3.10
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # LewwadooPalindrome
2
+
3
+ This gem is for recognizing whether a string is a palindrome. It is being made by following the tutorial "[https://www.learnenough.com/course/ruby/testing/testing_setup](Learn Enough Ruby to be Dangerous)".
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ $ bundle add lewwadoo_palindrome
10
+
11
+ If bundler is not being used to manage dependencies, install the gem by executing:
12
+
13
+ $ gem install lewwadoo_palindrome
14
+
15
+ ## Usage
16
+
17
+ There is no usage yet. Just watch it evolving.
18
+
19
+ ## Development
20
+
21
+ 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.
22
+
23
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
24
+
25
+ ## Contributing
26
+
27
+ Bug reports and pull requests are welcome on GitHub at https://github.com/LewWadoo/lewwadoo_palindrome.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
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
+ task default: :test
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "lib/lewwadoo_palindrome/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "lewwadoo_palindrome"
8
+ spec.version = LewwadooPalindrome::VERSION
9
+ spec.authors = ["Михайлов Евгений Сергеевич"]
10
+ spec.email = ["lewwadoo@gmail.com"]
11
+
12
+ spec.summary = "Palindrome detector"
13
+ spec.description = "Learn Enough Ruby to be Dangerous, chapter 8"
14
+ spec.homepage = "https://github.com/lewwadoo/lewwadoo_palindrome"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
21
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
28
+ end
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ # Uncomment to register a new dependency of your gem
35
+ # spec.add_dependency "example-gem", "~> 1.0"
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 LewwadooPalindrome
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lewwadoo_palindrome/version"
4
+
5
+ class String
6
+
7
+ # Returns true for a palindrome, false otherwise.
8
+ def palindrome?
9
+ processed_content == processed_content.reverse
10
+ end
11
+
12
+ # Returns the letters in the string.
13
+ def letters
14
+ letters_array = []
15
+ for letter_index in 0..self.length - 1 do
16
+ if (self[letter_index].match?(/[a-zA-Z]/))
17
+ letters_array << self[letter_index]
18
+ end
19
+ end
20
+ letters_array.join
21
+ end
22
+
23
+ private
24
+
25
+ # Returns content for palindrome testing.
26
+ def processed_content
27
+ scan(/[a-z]/i).join.downcase
28
+ end
29
+ end
@@ -0,0 +1,4 @@
1
+ module LewwadooPalindrome
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lewwadoo_palindrome
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Михайлов Евгений Сергеевич
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-06-10 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Learn Enough Ruby to be Dangerous, chapter 8
14
+ email:
15
+ - lewwadoo@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - Gemfile
21
+ - Gemfile.lock
22
+ - README.md
23
+ - Rakefile
24
+ - lewwadoo_palindrome.gemspec
25
+ - lib/lewwadoo_palindrome.rb
26
+ - lib/lewwadoo_palindrome/version.rb
27
+ - sig/lewwadoo_palindrome.rbs
28
+ homepage: https://github.com/lewwadoo/lewwadoo_palindrome
29
+ licenses: []
30
+ metadata:
31
+ allowed_push_host: https://rubygems.org
32
+ homepage_uri: https://github.com/lewwadoo/lewwadoo_palindrome
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 2.6.0
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubygems_version: 3.1.6
49
+ signing_key:
50
+ specification_version: 4
51
+ summary: Palindrome detector
52
+ test_files: []