Sha256: 51294e73f9cfa6780d403e1f2fafca58122974b1edb7a0a9f82ea03c979e2373

Contents?: true

Size: 715 Bytes

Versions: 9

Compression:

Stored size: 715 Bytes

Contents

# frozen_string_literal: true

require 'pathname'

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

Version data entries

9 entries across 9 versions & 1 rubygems

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