Skip to content

v0.7.0

Compare
Choose a tag to compare
@flash-gordon flash-gordon released this 05 Feb 09:58
v0.7.0
1e6a888

v0.7.0 - 2019-02-05

Changed

  • [BREAKING] Now only Ruby 2.3 and above is supported (flash-gordon)

Fixed

  • Symbols are now coerced to strings when resolving stubbed dependencies (cthulhu666)

  • Stubbing keys not present in container will raise an error (flash-gordon)

    This means after upgrading you may see errors like this

    ArgumentError (cannot stub "something" - no such key in container)
    

    Be sure you register dependencies before using them. The new behavior will likely save quite a bit of time when debugging ill-configured container setups.

Added

  • Namespace DSL resolves keys relative to the current namespace, see the corresponding changes (yuszuv)

  • Registered objects can be decorated with the following API (igor-alexandrov)

    class CreateUser
      def call(params)
        # ...
      end
    end
    container.register('create_user') { CreateUser.new }
    container.decorate('create_user', with: ShinyLogger.new)
    
    # Now subsequent resolutions will return a wrapped object
    
    container.resolve('create_user')
    # => #<ShinyLogger @obj=#<CreateUser:0x...>]>
  • Freezing a container now prevents further registrations (flash-gordon)

Internal

Compare v0.6.0...0.7.0