Sha256: c69a0603ab0f10004acf8e0c7a0f4eae5a3f1f4ce713fa91a7e363fe65ca65e3

Contents?: true

Size: 854 Bytes

Versions: 8

Compression:

Stored size: 854 Bytes

Contents

# frozen_string_literal: true

module Dry
  module Rails
    module Features
      # Controller helpers
      #
      # @api public
      module ControllerHelpers
        # Return a component from the application container
        #
        # @example
        #   def index
        #     users = resolve("users.index").(safe_params[:query])
        #     render json: users
        #   end
        #
        # @param key [Symbol, String] The component key
        #
        # @return [Object]
        #
        # @raise Dry::Container::Error
        #
        # @api public
        def resolve(key)
          container[key]
        end

        # Return the application container
        #
        # @return [Dry::Rails::Container]
        #
        # @api public
        def container
          Railtie.container
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dry-rails-0.7.0 lib/dry/rails/features/controller_helpers.rb
dry-rails-0.6.0 lib/dry/rails/features/controller_helpers.rb
dry-rails-0.5.0 lib/dry/rails/features/controller_helpers.rb
dry-rails-0.4.0 lib/dry/rails/features/controller_helpers.rb
dry-rails-0.3.0 lib/dry/rails/features/controller_helpers.rb
dry-rails-0.2.1 lib/dry/rails/features/controller_helpers.rb
dry-rails-0.2.0 lib/dry/rails/features/controller_helpers.rb
dry-rails-0.1.0 lib/dry/rails/features/controller_helpers.rb