awesome_palindrome 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9934b0b32cc7398fb27acff217ae8b8d4a549d47bbe845727db0c33bdfbf1035
4
+ data.tar.gz: c08f8bd76172ad732e3232264bea058635565732650bd1afd8b253a4a8b8d4cd
5
+ SHA512:
6
+ metadata.gz: f0361580257ecc02ab5245d60e79cacebbed6b528830cfe0a3269852886e47691d0765d8c5c02b229de67ac57c9fac221c9d33a6a737e43b7acb1bbdc07cb3e3
7
+ data.tar.gz: cb587b7179f76b058a0121e5c148db4657a53ed986f2b4d8c2eb0ca030bd0f5288c6c29f0ba487e321ecc14f0f88bd1a72273899f01c73e7d5edadc7256009a3
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 awesome_palindrome.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
11
+
12
+ gem 'minitest-reporters', '1.2.0'
data/Gemfile.lock ADDED
@@ -0,0 +1,30 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ awesome_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.16.3)
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-darwin-19
22
+
23
+ DEPENDENCIES
24
+ awesome_palindrome!
25
+ minitest (~> 5.0)
26
+ minitest-reporters (= 1.2.0)
27
+ rake (~> 13.0)
28
+
29
+ BUNDLED WITH
30
+ 2.3.19
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # Palindrome detector
2
+
3
+ `awesome_palindrome` is a sample Ruby gem created by Huang Xiaosheng.
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ ```bash
10
+ $ bundle add awesome_palindrome
11
+ ```
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ ```bash
16
+ $ gem install awesome_palindrome
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ `awesome_palindrome` adds a `palindrome?` method to the `String` and `Numeric` class, and can be used as follows:
22
+
23
+ ```
24
+ $ irb
25
+ >> require 'awesome_palindrome'
26
+ >> "honey badger".palindrome?
27
+ => false
28
+ >> "deified".palindrome?
29
+ => true
30
+ >> "Able was I, ere I saw Elba.".palindrome?
31
+ => true
32
+ >> 123.21.palindrome?
33
+ => true
34
+ ```
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome at https://github.com/Huang-Xiaosheng/ruby-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,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/awesome_palindrome/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "awesome_palindrome"
7
+ spec.version = AwesomePalindrome::VERSION
8
+ spec.authors = ["Huang Xiaosheng"]
9
+ spec.email = ["Huang-Xiaosheng@outlook.com"]
10
+
11
+ spec.summary = "Palindrome detector"
12
+ spec.homepage = "https://github.com/Huang-Xiaosheng/ruby-palindrome"
13
+ spec.required_ruby_version = ">= 2.6.0"
14
+
15
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(__dir__) do
24
+ `git ls-files -z`.split("\x0").reject do |f|
25
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
26
+ end
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ # Uncomment to register a new dependency of your gem
33
+ # spec.add_dependency "example-gem", "~> 1.0"
34
+
35
+ # For more information and examples about making a new gem, check out our
36
+ # guide at: https://bundler.io/guides/creating_gem.html
37
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AwesomePalindrome
4
+ VERSION = "1.0.0"
5
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "awesome_palindrome/version"
4
+
5
+ module AwesomePalindrome
6
+
7
+ # Returns true for a palindrome, false otherwise.
8
+ def palindrome?
9
+ tested_content = processed_content
10
+ tested_content == tested_content.reverse && !tested_content.empty?
11
+ end
12
+
13
+ private
14
+
15
+ # Returns content for palindrome testing.
16
+ def processed_content
17
+ to_s.scan(/[a-z0-9]/i).join.downcase
18
+ end
19
+ end
20
+
21
+ class String
22
+ include AwesomePalindrome
23
+ end
24
+
25
+ class Numeric
26
+ include AwesomePalindrome
27
+ end
@@ -0,0 +1,4 @@
1
+ module AwesomePalindrome
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: awesome_palindrome
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Huang Xiaosheng
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-09-14 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - Huang-Xiaosheng@outlook.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - Gemfile
21
+ - Gemfile.lock
22
+ - README.md
23
+ - Rakefile
24
+ - awesome_palindrome.gemspec
25
+ - lib/awesome_palindrome.rb
26
+ - lib/awesome_palindrome/version.rb
27
+ - sig/awesome_palindrome.rbs
28
+ homepage: https://github.com/Huang-Xiaosheng/ruby-palindrome
29
+ licenses: []
30
+ metadata:
31
+ allowed_push_host: https://rubygems.org/
32
+ homepage_uri: https://github.com/Huang-Xiaosheng/ruby-palindrome
33
+ source_code_uri: https://github.com/Huang-Xiaosheng/ruby-palindrome
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 2.6.0
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubygems_version: 3.3.7
50
+ signing_key:
51
+ specification_version: 4
52
+ summary: Palindrome detector
53
+ test_files: []