hsztan_palindrome 0.1.01 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efffe8a6ad0db3173538dc8c017ebb8ffa1c986a9f1e699794401ddda0379423
4
- data.tar.gz: 691bb9fd46adaf67af7725c4af1bed388d32509999659d886debeeae9fb5fe70
3
+ metadata.gz: 9402d88fd66008c86d20cbbeef6e17f9eada92e39ca44940bc00cde73dc53a7e
4
+ data.tar.gz: 16e15b34580692844ee9918e2447ec906c803b8da3c7938a44a91ffd3b9bb434
5
5
  SHA512:
6
- metadata.gz: ecfe4274d0d2ecae656af5ca445a25028785ec16c65752b3f2f6f9c7dd549e911170c7d561af6c4201ba1597a86ed79b2106db23f0f5dfaec00b455d3f8e33e3
7
- data.tar.gz: 74dae98fcea446e1e3103f3db140c370c09e6b17995c67f080d3aa7c160444801edc0ab4b7d1539370caafde58c6d6bc557d64ad944dee774f1320d4a64104a8
6
+ metadata.gz: 1d05facb3bc6206a8f9f2c5d0ec52d940ebff01f4c2ad9f722db39c6368bf1f7792e5af1e39482fa50b28efe2c6cc653542a185bfa7cf8f8b3c5efd4d91743aa
7
+ data.tar.gz: 5554ac94f11f1a017a41caef556437095ebf7016ebdeb59752f3ddd85d0b7d6348be463e02ba9df729ba45fbce9d741c8cac7a29ce82c37e38ddc30607d4eafc
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # HsztanPalindrome
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/hsztan_palindrome`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ To experiment with that code, run `bin/console` for an interactive prompt.
4
4
 
5
- This gem is a palindrome detector for strings. It can be used as a library or as a command line tool.
5
+ This gem is a palindrome detector for strings and integers. It can be used as a library or as a command line tool.
6
6
 
7
7
  ## Installation
8
8
 
@@ -22,9 +22,23 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Use as a library:
25
+ Use as a library:
26
26
 
27
- ```ruby
27
+ ```
28
+
29
+ require 'hsztan_palindrome'
30
+ ```
31
+
32
+ ```
33
+ "foo".palindrome? # => false
34
+
35
+ "racecar".palindrome? # => true
36
+
37
+ 12345.palindrome? # => false
38
+
39
+ 12321.palindrome? # => true
40
+
41
+ ```
28
42
 
29
43
  ## Development
30
44
 
@@ -1,3 +1,3 @@
1
1
  module HsztanPalindrome
2
- VERSION = "0.1.01"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require "hsztan_palindrome/version"
2
2
 
3
- class String
3
+ module HsztanPalindrome
4
4
 
5
5
  def palindrome?
6
6
  processed_content == processed_content.reverse
@@ -9,6 +9,14 @@ class String
9
9
  private
10
10
 
11
11
  def processed_content
12
- self.scan(/[a-z]/i).join.downcase
12
+ self.to_s.scan(/[a-z\d]/i).join.downcase
13
13
  end
14
+ end
15
+
16
+ class String
17
+ include HsztanPalindrome
18
+ end
19
+
20
+ class Integer
21
+ include HsztanPalindrome
14
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hsztan_palindrome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.01
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henry Nawrocki