Sha256: 623caeaa3231a97431187143da68d78fefefcaa5951feea7ef6925143095c543

Contents?: true

Size: 822 Bytes

Versions: 10

Compression:

Stored size: 822 Bytes

Contents

# frozen_string_literal: true

require 'pathname'

require 'rom/support/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
        Inflector.camelize(
          file.sub(%r{^#{directory}/#{entity}/}, '').sub(EXTENSION_REGEX, '')
        )
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rom-core-5.4.0 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-5.3.2 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-5.3.1 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-5.3.0 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-5.2.6 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-5.2.5 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-5.2.4 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-5.2.3 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-5.2.2 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-5.2.1 lib/rom/setup/auto_registration_strategies/no_namespace.rb