module SmartCore::Schema::KeyControl

@api private @since 0.1.0

Public Class Methods

normalize(key) click to toggle source

@param key [String, Symbol] @return [String]

@api private @since 0.1.0

# File lib/smart_core/schema/key_control.rb, line 12
def normalize(key)
  prevent_incompatible!(key)
  key.to_s
end
normalize_list(keys) click to toggle source

@param keys [Array<String,Symbol>] @return [Array<String>]

@api private @since 0.1.0

# File lib/smart_core/schema/key_control.rb, line 22
def normalize_list(keys)
  keys.map { |key| normalize(key) }
end
prevent_incompatible!(key) click to toggle source

@param key [String, Symbol] @return [void]

@api private @since 0.1.0

# File lib/smart_core/schema/key_control.rb, line 31
    def prevent_incompatible!(key)
      unless key.is_a?(String) || key.is_a?(Symbol)
        raise(SmartCore::Schema::ArgumentError, <<~ERROR_MESSAGE)
          Schema keys should be a type of string or symbol
        ERROR_MESSAGE
      end
    end