Method: Dynamoid::Indexes::ClassMethods#index_key

Defined in:
lib/dynamoid/indexes.rb

#index_key(hash, range = nil) ⇒ String

Generates a convenient lookup key name for a hash/range index. Should normally not be used directly.

Parameters:

  • hash (Symbol)

    hash key name.

  • range (Symbol) (defaults to: nil)

    range key name.

Returns:

  • (String)

    returns “hash” if hash only, “hash_range” otherwise.



129
130
131
132
133
134
135
# File 'lib/dynamoid/indexes.rb', line 129

def index_key(hash, range=nil)
  name = hash.to_s
  if range.present?
    name += "_#{range.to_s}"
  end
  name
end