shaped 0.7.3 → 0.8.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/.github/workflows/ruby.yml +21 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +18 -18
- data/README.md +17 -1
- data/lib/shaped/shapes/callable.rb +1 -0
- data/lib/shaped/version.rb +1 -1
- metadata +4 -4
- data/.travis.yml +0 -14
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9a84f7dd70b2d40e32d1dde68014ec240d1681ef75f9c111d7ef52943a99cbab
         | 
| 4 | 
            +
              data.tar.gz: bf55523db329247de28c8140a8b4e06392879b6893649bf5de3e4c5da206bbde
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 72652921092823a183d70edad881be6e3ad881c5c443ce9b2513b54975e6acda118716ed35e597c3414cfdd40ed0cf93ee884d4429c5f4dce445a254dcfa30de
         | 
| 7 | 
            +
              data.tar.gz: 0d6e6d2951c4885cf22389da5805211f1410c48b442183067fa862218a967b380e112971f63c08c5e4842723ca77517ebaf4ff3fe7b8b348e0dcc23a8d265fe8
         | 
| @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            name: Run Tests, Linters, Etc.
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            on:
         | 
| 4 | 
            +
              pull_request:
         | 
| 5 | 
            +
                branches:
         | 
| 6 | 
            +
                - master
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            jobs:
         | 
| 9 | 
            +
              build:
         | 
| 10 | 
            +
                runs-on: ubuntu-latest
         | 
| 11 | 
            +
                steps:
         | 
| 12 | 
            +
                - uses: actions/checkout@v2
         | 
| 13 | 
            +
                - uses: ruby/setup-ruby@v1
         | 
| 14 | 
            +
                  with:
         | 
| 15 | 
            +
                    bundler-cache: true
         | 
| 16 | 
            +
                - name: Run Rubocop
         | 
| 17 | 
            +
                  run: bin/rubocop --format clang
         | 
| 18 | 
            +
                - name: Run RSpec tests
         | 
| 19 | 
            +
                  run: bin/rspec --format progress
         | 
| 20 | 
            +
                - name: Ensure no git diff
         | 
| 21 | 
            +
                  run: git diff --exit-code && git diff-index --quiet --cached HEAD
         | 
    
        data/.ruby-version
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            2.7. | 
| 1 | 
            +
            2.7.2
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,11 @@ | |
| 1 | 
            +
            ## v0.8.0 (2021-01-31)
         | 
| 2 | 
            +
            ### Added
         | 
| 3 | 
            +
            - Accept `Method` as a `Callable` shape definition
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ### Internal
         | 
| 6 | 
            +
            - Bump Ruby version from 2.7.0 to 2.7.2
         | 
| 7 | 
            +
            - Move from Travis to GitHub Actions
         | 
| 8 | 
            +
             | 
| 1 9 | 
             
            ## v0.7.3 (2021-01-07)
         | 
| 2 10 | 
             
            ### Removed
         | 
| 3 11 | 
             
            - Removed `::name` method for anonymous validator class in `Shaped::Shapes::Class`
         | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -9,14 +9,14 @@ GIT | |
| 9 9 |  | 
| 10 10 | 
             
            GIT
         | 
| 11 11 | 
             
              remote: https://github.com/davidrunger/runger_style.git
         | 
| 12 | 
            -
              revision:  | 
| 12 | 
            +
              revision: ba2f3c3600bd393a3141a4883489ac15e19dbfd0
         | 
| 13 13 | 
             
              specs:
         | 
| 14 | 
            -
                runger_style (0.2. | 
| 14 | 
            +
                runger_style (0.2.15)
         | 
| 15 15 |  | 
| 16 16 | 
             
            PATH
         | 
| 17 17 | 
             
              remote: .
         | 
| 18 18 | 
             
              specs:
         | 
| 19 | 
            -
                shaped (0. | 
| 19 | 
            +
                shaped (0.8.0)
         | 
| 20 20 | 
             
                  activemodel (~> 6.0)
         | 
| 21 21 | 
             
                  activesupport (~> 6.0)
         | 
| 22 22 |  | 
| @@ -34,12 +34,12 @@ GEM | |
| 34 34 | 
             
                amazing_print (1.2.2)
         | 
| 35 35 | 
             
                ast (2.4.1)
         | 
| 36 36 | 
             
                byebug (11.1.3)
         | 
| 37 | 
            -
                codecov (0. | 
| 38 | 
            -
                  simplecov (>= 0.15, < 0. | 
| 37 | 
            +
                codecov (0.4.0)
         | 
| 38 | 
            +
                  simplecov (>= 0.15, < 0.22)
         | 
| 39 39 | 
             
                coderay (1.1.3)
         | 
| 40 | 
            -
                concurrent-ruby (1.1. | 
| 40 | 
            +
                concurrent-ruby (1.1.8)
         | 
| 41 41 | 
             
                diff-lcs (1.4.4)
         | 
| 42 | 
            -
                docile (1.3. | 
| 42 | 
            +
                docile (1.3.5)
         | 
| 43 43 | 
             
                ffi (1.13.1)
         | 
| 44 44 | 
             
                formatador (0.2.5)
         | 
| 45 45 | 
             
                guard (2.16.2)
         | 
| @@ -93,26 +93,26 @@ GEM | |
| 93 93 | 
             
                  diff-lcs (>= 1.2.0, < 2.0)
         | 
| 94 94 | 
             
                  rspec-support (~> 3.10.0)
         | 
| 95 95 | 
             
                rspec-support (3.10.1)
         | 
| 96 | 
            -
                rubocop ( | 
| 96 | 
            +
                rubocop (1.8.1)
         | 
| 97 97 | 
             
                  parallel (~> 1.10)
         | 
| 98 | 
            -
                  parser (>=  | 
| 98 | 
            +
                  parser (>= 3.0.0.0)
         | 
| 99 99 | 
             
                  rainbow (>= 2.2.2, < 4.0)
         | 
| 100 | 
            -
                  regexp_parser (>= 1.8)
         | 
| 100 | 
            +
                  regexp_parser (>= 1.8, < 3.0)
         | 
| 101 101 | 
             
                  rexml
         | 
| 102 | 
            -
                  rubocop-ast (>=  | 
| 102 | 
            +
                  rubocop-ast (>= 1.2.0, < 2.0)
         | 
| 103 103 | 
             
                  ruby-progressbar (~> 1.7)
         | 
| 104 | 
            -
                  unicode-display_width (>= 1.4.0, <  | 
| 104 | 
            +
                  unicode-display_width (>= 1.4.0, < 3.0)
         | 
| 105 105 | 
             
                rubocop-ast (1.4.0)
         | 
| 106 106 | 
             
                  parser (>= 2.7.1.5)
         | 
| 107 107 | 
             
                rubocop-performance (1.9.2)
         | 
| 108 108 | 
             
                  rubocop (>= 0.90.0, < 2.0)
         | 
| 109 109 | 
             
                  rubocop-ast (>= 0.4.0)
         | 
| 110 | 
            -
                rubocop-rspec (1. | 
| 111 | 
            -
                  rubocop (~> 0 | 
| 112 | 
            -
                  rubocop-ast (>=  | 
| 110 | 
            +
                rubocop-rspec (2.1.0)
         | 
| 111 | 
            +
                  rubocop (~> 1.0)
         | 
| 112 | 
            +
                  rubocop-ast (>= 1.1.0)
         | 
| 113 113 | 
             
                ruby-progressbar (1.11.0)
         | 
| 114 114 | 
             
                shellany (0.0.1)
         | 
| 115 | 
            -
                simplecov (0. | 
| 115 | 
            +
                simplecov (0.21.2)
         | 
| 116 116 | 
             
                  docile (~> 1.1)
         | 
| 117 117 | 
             
                  simplecov-html (~> 0.11)
         | 
| 118 118 | 
             
                  simplecov_json_formatter (~> 0.1)
         | 
| @@ -121,7 +121,7 @@ GEM | |
| 121 121 | 
             
                thor (1.0.1)
         | 
| 122 122 | 
             
                tzinfo (2.0.4)
         | 
| 123 123 | 
             
                  concurrent-ruby (~> 1.0)
         | 
| 124 | 
            -
                unicode-display_width ( | 
| 124 | 
            +
                unicode-display_width (2.0.0)
         | 
| 125 125 | 
             
                zeitwerk (2.4.2)
         | 
| 126 126 |  | 
| 127 127 | 
             
            PLATFORMS
         | 
| @@ -141,4 +141,4 @@ DEPENDENCIES | |
| 141 141 | 
             
              shaped!
         | 
| 142 142 |  | 
| 143 143 | 
             
            BUNDLED WITH
         | 
| 144 | 
            -
               2.1. | 
| 144 | 
            +
               2.1.4
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,5 +1,4 @@ | |
| 1 1 | 
             
            [](https://codecov.io/gh/davidrunger/shaped)
         | 
| 2 | 
            -
            [](https://travis-ci.com/davidrunger/shaped)
         | 
| 3 2 | 
             
            [](https://dependabot.com)
         | 
| 4 3 | 
             
            [](https://badge.fury.io/rb/shaped)
         | 
| 5 4 |  | 
| @@ -240,6 +239,23 @@ shape.matched_by?(5) # fails the `#even?` check | |
| 240 239 | 
             
            shape.matched_by?(10) # fails the `#cover?` check (10 is too high)
         | 
| 241 240 | 
             
            # => false
         | 
| 242 241 | 
             
            ```
         | 
| 242 | 
            +
             | 
| 243 | 
            +
            If you'd like to provide a named method rather than an anonymous proc/lambda, you can do that, too:
         | 
| 244 | 
            +
             | 
| 245 | 
            +
            ```rb
         | 
| 246 | 
            +
            def number_is_greater_than_thirty?(number)
         | 
| 247 | 
            +
              number > 30
         | 
| 248 | 
            +
            end
         | 
| 249 | 
            +
             | 
| 250 | 
            +
            shape = Shaped::Shape(method(:number_is_greater_than_thirty?))
         | 
| 251 | 
            +
             | 
| 252 | 
            +
            shape.matched_by?(31)
         | 
| 253 | 
            +
            # => true
         | 
| 254 | 
            +
             | 
| 255 | 
            +
            shape.matched_by?(29)
         | 
| 256 | 
            +
            # => false
         | 
| 257 | 
            +
            ```
         | 
| 258 | 
            +
             | 
| 243 259 | 
             
            You can also provide an instance of a custom class that implements a `#call` instance method:
         | 
| 244 260 |  | 
| 245 261 | 
             
            ```rb
         | 
| @@ -11,6 +11,7 @@ class Shaped::Shapes::Callable < Shaped::Shape | |
| 11 11 |  | 
| 12 12 | 
             
              def to_s
         | 
| 13 13 | 
             
                case @callable
         | 
| 14 | 
            +
                when Method then "Method defined at #{@callable.source_location.map(&:to_s).join(':')}"
         | 
| 14 15 | 
             
                when Proc then "Proc test defined at #{@callable.source_location.map(&:to_s).join(':')}"
         | 
| 15 16 | 
             
                else "#call test defined at #{@callable.method(:call).source_location.map(&:to_s).join(':')}"
         | 
| 16 17 | 
             
                end
         | 
    
        data/lib/shaped/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: shaped
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.8.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - David Runger
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2021-01 | 
| 11 | 
            +
            date: 2021-02-01 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activemodel
         | 
| @@ -45,11 +45,11 @@ executables: [] | |
| 45 45 | 
             
            extensions: []
         | 
| 46 46 | 
             
            extra_rdoc_files: []
         | 
| 47 47 | 
             
            files:
         | 
| 48 | 
            +
            - ".github/workflows/ruby.yml"
         | 
| 48 49 | 
             
            - ".gitignore"
         | 
| 49 50 | 
             
            - ".rspec"
         | 
| 50 51 | 
             
            - ".rubocop.yml"
         | 
| 51 52 | 
             
            - ".ruby-version"
         | 
| 52 | 
            -
            - ".travis.yml"
         | 
| 53 53 | 
             
            - CHANGELOG.md
         | 
| 54 54 | 
             
            - Gemfile
         | 
| 55 55 | 
             
            - Gemfile.lock
         | 
| @@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 97 97 | 
             
                - !ruby/object:Gem::Version
         | 
| 98 98 | 
             
                  version: '0'
         | 
| 99 99 | 
             
            requirements: []
         | 
| 100 | 
            -
            rubygems_version: 3.1. | 
| 100 | 
            +
            rubygems_version: 3.1.4
         | 
| 101 101 | 
             
            signing_key:
         | 
| 102 102 | 
             
            specification_version: 4
         | 
| 103 103 | 
             
            summary: Validate the "shape" of Ruby objects.
         |