djyarber_palindrome 0.1.0 → 0.2.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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +9 -1
- data/lib/djyarber_palindrome/version.rb +1 -1
- data/lib/djyarber_palindrome.rb +11 -2
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 7597eda4f7843105dee11a43967545a249f7418caaf18238e9d54ed155bd112f
         | 
| 4 | 
            +
              data.tar.gz: 691e6164d8914449cb3756e61ec581e4807bac1e37095dad392764b789c6d0ff
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 54416ad1e9c576a084139a30424b63efc00f8c43158130f5dc6fc218632a2e1f8d19c39a3ac322b0ad72e0e103b0e9e158f0ece28486220e84f3e86110c003af
         | 
| 7 | 
            +
              data.tar.gz: a11fc10cead9200f21f81effbb270274cc8c65a9c38460377df2fa8dc240d22198691dda558bc79e5cc2dfa1d800bf45974f1a7f93bc7fc2738f3afce8116c34
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -24,7 +24,7 @@ gem install djyarber_palindrome | |
| 24 24 |  | 
| 25 25 | 
             
            ## Usage
         | 
| 26 26 |  | 
| 27 | 
            -
            `djyarber_palindrome` adds a `palindrome?` method to the `String`  | 
| 27 | 
            +
            `djyarber_palindrome` adds a `palindrome?` method to the `String` and `Integer` classes, and can be used as follows:
         | 
| 28 28 |  | 
| 29 29 | 
             
            ```ruby
         | 
| 30 30 | 
             
            $ irb
         | 
| @@ -48,6 +48,14 @@ Run tests: | |
| 48 48 | 
             
            bundle exec rake test
         | 
| 49 49 | 
             
            ```
         | 
| 50 50 |  | 
| 51 | 
            +
            Release new version:
         | 
| 52 | 
            +
             | 
| 53 | 
            +
            Update the version number in `version.rb`, then run
         | 
| 54 | 
            +
             | 
| 55 | 
            +
            ```sh
         | 
| 56 | 
            +
            bundle exec rake release
         | 
| 57 | 
            +
            ```
         | 
| 58 | 
            +
             | 
| 51 59 | 
             
            ## License
         | 
| 52 60 |  | 
| 53 61 | 
             
            The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
         | 
    
        data/lib/djyarber_palindrome.rb
    CHANGED
    
    | @@ -2,7 +2,8 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            require_relative "djyarber_palindrome/version"
         | 
| 4 4 |  | 
| 5 | 
            -
            class String
         | 
| 5 | 
            +
            # class String
         | 
| 6 | 
            +
            module DjyarberPalindrome
         | 
| 6 7 | 
             
              # Returns true for a palindrome, false otherwise.
         | 
| 7 8 | 
             
              def palindrome?
         | 
| 8 9 | 
             
                processed_content == processed_content.reverse
         | 
| @@ -12,6 +13,14 @@ class String | |
| 12 13 |  | 
| 13 14 | 
             
              # Returns content for palindrome testing.
         | 
| 14 15 | 
             
              def processed_content
         | 
| 15 | 
            -
                scan(/[a- | 
| 16 | 
            +
                to_s.scan(/[a-z0-9]/i).join.downcase
         | 
| 16 17 | 
             
              end
         | 
| 18 | 
            +
            end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            class String
         | 
| 21 | 
            +
              include DjyarberPalindrome
         | 
| 22 | 
            +
            end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            class Integer
         | 
| 25 | 
            +
              include DjyarberPalindrome
         | 
| 17 26 | 
             
            end
         |