Sha256: 381fb8d3ec60013c5273d682eb26f47a916b5515170d0a99ae151bf2c0f49d18

Contents?: true

Size: 685 Bytes

Versions: 1

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true

require "pathname"

require "rom/support/inflector"
require_relative "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

1 entries across 1 versions & 1 rubygems

Version Path
rom-6.0.0.alpha1 lib/rom/compat/auto_registration_strategies/with_namespace.rb