Sha256: f3233a6ec42966c87182b79ea2fc45dda81123a47fbd0abfc0fde8a3604e3cec

Contents?: true

Size: 691 Bytes

Versions: 5

Compression:

Stored size: 691 Bytes

Contents

require 'pathname'

require 'dry/core/inflector'
require 'rom/setup/auto_registration_strategies/base'

module ROM
  module AutoRegistrationStrategies
    # WithNamespace strategy assumes components are defined within a namespace
    # that matches top-level directory name.
    #
    # @api private
    class WithNamespace < Base
      # @!attribute [r] directory
      #   @return [Pathname] The path to dir with components
      option :directory, type: PathnameType

      # Load components
      #
      # @api private
      def call
        Dry::Core::Inflector.camelize(
          file.sub(/^#{directory.dirname}\//, '').sub(EXTENSION_REGEX, '')
        )
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rom-core-4.0.2 lib/rom/setup/auto_registration_strategies/with_namespace.rb
rom-core-4.0.1 lib/rom/setup/auto_registration_strategies/with_namespace.rb
rom-core-4.0.0 lib/rom/setup/auto_registration_strategies/with_namespace.rb
rom-core-4.0.0.rc2 lib/rom/setup/auto_registration_strategies/with_namespace.rb
rom-core-4.0.0.rc1 lib/rom/setup/auto_registration_strategies/with_namespace.rb