Sha256: 055a057711af893bfec8c17eaf7f633092a0ae3b150a3e8aeda49da1e1dcafd1

Contents?: true

Size: 683 Bytes

Versions: 5

Compression:

Stored size: 683 Bytes

Contents

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(/^#{directory.dirname}\//, '').sub(EXTENSION_REGEX, '')
        )
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rom-core-4.2.1 lib/rom/setup/auto_registration_strategies/with_namespace.rb
rom-core-4.2.0 lib/rom/setup/auto_registration_strategies/with_namespace.rb
rom-core-4.1.2 lib/rom/setup/auto_registration_strategies/with_namespace.rb
rom-core-4.1.1 lib/rom/setup/auto_registration_strategies/with_namespace.rb
rom-core-4.1.0 lib/rom/setup/auto_registration_strategies/with_namespace.rb