Sha256: b429103c055d59cab191fb1d3b99da2015f1e47c5242dab6e633eeff69ced13a

Contents?: true

Size: 822 Bytes

Versions: 6

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rom-core-5.1.2 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-5.1.1 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-5.1.0 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-5.0.2 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-5.0.1 lib/rom/setup/auto_registration_strategies/no_namespace.rb
rom-core-5.0.0 lib/rom/setup/auto_registration_strategies/no_namespace.rb