dry-dependency-injection 0.1.0 → 0.1.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 +5 -5
- data/README.md +1 -1
- data/example/plugins/books.rb +10 -0
- data/example/plugins/first.rb +1 -1
- data/example/plugins/ng/third.rb +1 -1
- data/example/plugins/second.rb +1 -1
- data/lib/dry/dependency_injection/importer.rb +1 -1
- data/lib/dry/dependency_injection/version.rb +1 -1
- data/spec/importer_spec.rb +2 -2
- metadata +4 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 2 | 
            +
            SHA256:
         | 
| 3 | 
            +
              metadata.gz: 5edcb4fc459468513005dfcb4aedec7dcfcaf18e600dbc9c65efbdcc1dc3fbdc
         | 
| 4 | 
            +
              data.tar.gz: 9b7c465e99af2e317e39752bd825fd5b7232c6de076bbb8c78204a58be315c8e
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 25594f58c381f74371845b86967fb1b3cf784c4c95d6c22bfa6c3333535b69af5495cf2a77a8225e7177eedbf38b5b2065d62bb3b4f302c68a7f29119bb8331f
         | 
| 7 | 
            +
              data.tar.gz: c4bf5229708ef2b13843e93f748328c87e7ef9ba941a23db522ca376cdbbd79725d0259a8aa0b6959ac275eef28c688d71912edd769c7c8db5fbcb12cc496cc0
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            [gem]: https:// | 
| 1 | 
            +
            [gem]: https://badge.fury.io/rb/dry-dependency-injection
         | 
| 2 2 | 
             
            [travis]: https://travis-ci.org/mkristian/dry-dependency-injection
         | 
| 3 3 | 
             
            [gemnasium]: https://gemnasium.com/mkristian/dry-dependency-injection
         | 
| 4 4 | 
             
            [codeclimate]: https://codeclimate.com/github/mkristian/dry-dependency-injection
         | 
| @@ -0,0 +1,10 @@ | |
| 1 | 
            +
            # need a plural class to test the inflection from filename to class constant
         | 
| 2 | 
            +
            class Books
         | 
| 3 | 
            +
              extend Dry::DependencyInjection::Eager
         | 
| 4 | 
            +
              include Dependency['registry']
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              def initialize(**)
         | 
| 7 | 
            +
                super
         | 
| 8 | 
            +
                registry.register(Dry::Core::Inflector.underscore(self.class.to_s).sub('/', '.'), self)
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
            end
         | 
    
        data/example/plugins/first.rb
    CHANGED
    
    
    
        data/example/plugins/ng/third.rb
    CHANGED
    
    
    
        data/example/plugins/second.rb
    CHANGED
    
    
| @@ -16,7 +16,7 @@ module Dry | |
| 16 16 | 
             
                    Dir[File.join(full, prefix, '**', '*.rb')].each do |file|
         | 
| 17 17 | 
             
                      require file
         | 
| 18 18 | 
             
                      subpath = file.gsub(/#{full}\/|\.rb/, '')
         | 
| 19 | 
            -
                      class_name = Dry::Core::Inflector. | 
| 19 | 
            +
                      class_name = Dry::Core::Inflector.camelize(subpath)
         | 
| 20 20 | 
             
                      clazz = Dry::Core::Inflector.constantize(class_name)
         | 
| 21 21 | 
             
                      if clazz.is_a?(Class)
         | 
| 22 22 | 
             
                        key = subpath.gsub('/', '.')
         | 
    
        data/spec/importer_spec.rb
    CHANGED
    
    | @@ -7,7 +7,7 @@ describe Dry::DependencyInjection::Importer do | |
| 7 7 | 
             
                require 'setup'
         | 
| 8 8 |  | 
| 9 9 | 
             
                result = App.new.run
         | 
| 10 | 
            -
                expect(result.keys).to match_array ['first', 'second', 'ng.third']
         | 
| 11 | 
            -
                expect(result.values.collect{|v| v.sub(/:0.*/, '')}).to match_array ['#<First', '#<Second', '#<Ng::Third']
         | 
| 10 | 
            +
                expect(result.keys).to match_array ['books', 'first', 'second', 'ng.third']
         | 
| 11 | 
            +
                expect(result.values.collect{|v| v.sub(/:0.*/, '')}).to match_array ['#<Books', '#<First', '#<Second', '#<Ng::Third']
         | 
| 12 12 | 
             
              end
         | 
| 13 13 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: dry-dependency-injection
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - ''
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2018-03-01 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: concurrent-ruby
         | 
| @@ -136,6 +136,7 @@ files: | |
| 136 136 | 
             
            - LICENSE
         | 
| 137 137 | 
             
            - README.md
         | 
| 138 138 | 
             
            - dry-dependency-injection.gemspec
         | 
| 139 | 
            +
            - example/plugins/books.rb
         | 
| 139 140 | 
             
            - example/plugins/first.rb
         | 
| 140 141 | 
             
            - example/plugins/ng/third.rb
         | 
| 141 142 | 
             
            - example/plugins/registry.rb
         | 
| @@ -172,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 172 173 | 
             
                  version: '0'
         | 
| 173 174 | 
             
            requirements: []
         | 
| 174 175 | 
             
            rubyforge_project: 
         | 
| 175 | 
            -
            rubygems_version: 2.5 | 
| 176 | 
            +
            rubygems_version: 2.7.5
         | 
| 176 177 | 
             
            signing_key: 
         | 
| 177 178 | 
             
            specification_version: 4
         | 
| 178 179 | 
             
            summary: add dependency injection to dry-container
         |