Sha256: 2828acd47e276d23e32ef7c35fcf58fa2acc2cfd7ed6a56e71652d15f8c9a744

Contents?: true

Size: 742 Bytes

Versions: 12

Compression:

Stored size: 742 Bytes

Contents

# frozen_string_literal: true

# @api priavate
# @since 0.1.0
module SmartCore::Container::KeyGuard
  class << self
    # @param key [Symbol, String]
    # @return [void]
    #
    # @raise [SmartCore::Container::IncompatibleEntityNameError]
    #
    # @api private
    # @since 0.1.0
    def prevent_incomparabilities!(key)
      raise(
        SmartCore::Container::IncompatibleEntityNameError,
        'Namespace/Dependency name should be a symbol or a string'
      ) unless key.is_a?(String) || key.is_a?(Symbol)
    end

    # @param key [Symbol, String]
    # @return [String]
    #
    # @api private
    # @since 0.1.0
    def indifferently_accessable_key(key)
      prevent_incomparabilities!(key)
      key.to_s
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
smart_container-0.11.0 lib/smart_core/container/key_guard.rb
smart_container-0.10.0 lib/smart_core/container/key_guard.rb
smart_container-0.9.0 lib/smart_core/container/key_guard.rb
smart_container-0.8.1 lib/smart_core/container/key_guard.rb
smart_container-0.8.0 lib/smart_core/container/key_guard.rb
smart_container-0.7.0 lib/smart_core/container/key_guard.rb
smart_container-0.6.0 lib/smart_core/container/key_guard.rb
smart_container-0.5.0 lib/smart_core/container/key_guard.rb
smart_container-0.4.0 lib/smart_core/container/key_guard.rb
smart_container-0.3.0 lib/smart_core/container/key_guard.rb
smart_container-0.2.0 lib/smart_core/container/key_guard.rb
smart_container-0.1.0 lib/smart_core/container/key_guard.rb