wslian_palindrome 1.0.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: d6a2d2c4e82cbc54bf3401df970edcc7ccaf4cbbac0a00fb0aa1b043ef9cb5fe
4
+ data.tar.gz: b70784613fb8c5c71f9c2343bf0b329860923c4d96f0743fc935806103bb0973
5
+ SHA512:
6
+ metadata.gz: 3c78e9ddcf1dd6cc29b710b514772f7c43ca8b2c2016866809462e8158ca16a308cd838114e76f54786bae4c28dd1a0174d61979c477e2a36ad8041d4fd4165d
7
+ data.tar.gz: 4d53ed4f344fea835b3999c0a407fe7c5a0147b6dd0091aee16d8bca677a184b3909301bcfe780c44e5a99443380e67bd016d9c3075418819c0c5079706ca05e
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in wslian_palindrome.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
11
+
12
+ gem "minitest-reporters", "~> 1.5"
data/Gemfile.lock ADDED
@@ -0,0 +1,31 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ wslian_palindrome (1.0.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.5.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-darwin-20
22
+ x86_64-linux
23
+
24
+ DEPENDENCIES
25
+ minitest (~> 5.0)
26
+ minitest-reporters (~> 1.5)
27
+ rake (~> 13.0)
28
+ wslian_palindrome!
29
+
30
+ BUNDLED WITH
31
+ 2.3.14
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # WslianPalindrome
2
+
3
+ # Palindrome detector
4
+
5
+ `mhartl_palindrome` is a sample Ruby gem created in [*Learn Enough Ruby to Be Dangerous*](https://www.learnenough.com/ruby-tutorial) by Michael Hartl.
6
+
7
+ ## Installation
8
+
9
+ To install `mhartl_palindrome`, add this line to your application's `Gemfile`:
10
+
11
+ ```
12
+ gem 'mhartl_palindrome'
13
+ ```
14
+
15
+ Then install as follows:
16
+
17
+ ```
18
+ $ bundle install
19
+ ```
20
+
21
+ Or install it directly using `gem`:
22
+
23
+ ```
24
+ $ gem install mhartl_palindrome
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ `mhartl_palindrome` adds a `palindrome?` method to the `String` class, and can be used as follows:
30
+
31
+ ```
32
+ $ irb
33
+ >> require 'mhartl_palindrome'
34
+ >> "honey badger".palindrome?
35
+ => false
36
+ >> "deified".palindrome?
37
+ => true
38
+ >> "Able was I, ere I saw Elba.".palindrome?
39
+ => true
40
+ >> phrase = "Madam, I'm Adam."
41
+ >> phrase.palindrome?
42
+ => true
43
+ ```
44
+
45
+ ## License
46
+
47
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
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,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WslianPalindrome
4
+ VERSION = "1.0.0"
5
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "wslian_palindrome/version"
4
+
5
+ module WslianPalindrome
6
+ def palindrome?
7
+ processed_content == processed_content.reverse
8
+ end
9
+
10
+ def processed_content
11
+ to_s.downcase.letters
12
+ end
13
+
14
+ def letters
15
+ scan(/[1-9a-z]/i).join
16
+ end
17
+ end
18
+
19
+ class String
20
+ include WslianPalindrome
21
+ end
22
+
23
+ class Integer
24
+ include WslianPalindrome
25
+ end
@@ -0,0 +1,4 @@
1
+ module WslianPalindrome
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/wslian_palindrome/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "wslian_palindrome"
7
+ spec.version = WslianPalindrome::VERSION
8
+ spec.authors = ["Wei-Shiang Lian"]
9
+ spec.email = ["weishianglian@gmail.com"]
10
+
11
+ spec.summary = %q{Palindrome detector}
12
+ spec.description = %q{Learn Enough Ruby palindrome detector}
13
+ spec.homepage = "https://github.com/weishianglian/wslian_palindrome"
14
+ spec.license = "MIT"
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"] = "https://github.com/weishianglian/wslian_palindrome"
21
+ spec.metadata["changelog_uri"] = "https://github.com/weishianglian/wslian_palindrome"
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(__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
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wslian_palindrome
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Wei-Shiang Lian
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-05-31 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Learn Enough Ruby palindrome detector
14
+ email:
15
+ - weishianglian@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - Gemfile
21
+ - Gemfile.lock
22
+ - README.md
23
+ - Rakefile
24
+ - lib/wslian_palindrome.rb
25
+ - lib/wslian_palindrome/version.rb
26
+ - sig/wslian_palindrome.rbs
27
+ - wslian_palindrome.gemspec
28
+ homepage: https://github.com/weishianglian/wslian_palindrome
29
+ licenses:
30
+ - MIT
31
+ metadata:
32
+ allowed_push_host: https://rubygems.org/
33
+ homepage_uri: https://github.com/weishianglian/wslian_palindrome
34
+ source_code_uri: https://github.com/weishianglian/wslian_palindrome
35
+ changelog_uri: https://github.com/weishianglian/wslian_palindrome
36
+ post_install_message:
37
+ rdoc_options: []
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 2.6.0
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubygems_version: 3.3.7
52
+ signing_key:
53
+ specification_version: 4
54
+ summary: Palindrome detector
55
+ test_files: []