Sha256: 3ab124bf4090b7d4b02c06016f8d478e2c278878aea25548da4af57dd6ac0977

Contents?: true

Size: 799 Bytes

Versions: 5

Compression:

Stored size: 799 Bytes

Contents

require 'pathname'

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

module ROM
  module AutoRegistrationStrategies
    # NoNamespace strategy assumes components are not defined within a namespace
    #
    # @api private
    class NoNamespace < Base
      # @!attribute [r] directory
      #   @return [Pathname] The path to dir with components
      option :directory, type: PathnameType

      # @!attribute [r] entity
      #   @return [Symbol] Component identifier
      option :entity, type: Types::Strict::Symbol

      # Load components
      #
      # @api private
      def call
        Dry::Core::Inflector.camelize(
          file.sub(/^#{directory}\/#{entity}\//, '').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/no_namespace.rb
rom-core-4.0.1 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-4.0.0 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-4.0.0.rc2 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-4.0.0.rc1 lib/rom/setup/auto_registration_strategies/no_namespace.rb