class Ashikawa::Core::KeyOptions

Options for controlling keys of a collection

Attributes

allow_user_keys[R]

Is the user allowed to set keys by him- or herself?

@return Boolean @api public @example Get the type of the KeyOptions

keyOptions = KeyOptions.new({ :allowUserKeys => true })
keyOptions.allow_user_keys # => true
increment[R]

Size of increment steps

@return Fixnum @api public @example Get the type of the KeyOptions

keyOptions = KeyOptions.new({ :increment => 12 })
keyOptions.increment # => 12
offset[R]

A specific start value

@return Fixnum @api public @example Get the type of the KeyOptions

keyOptions = KeyOptions.new({ :offset => 12 })
keyOptions.offset # => 12
type[R]

Either traditional or autoincrement

@return Symbol @api public @example Get the type of the KeyOptions

keyOptions = KeyOptions.new({ :type => :autoincrement })
keyOptions.type # => :autoincrement

Public Class Methods

new(raw_key_options) click to toggle source

Create a new KeyOptions object from the raw key options

@param [Hash] raw_key_options The raw options for the key returned from the server @api public @example Create a new KeyOptions object

KeyOptions.new({ :type => :autoincrement })
# File lib/ashikawa-core/key_options.rb, line 47
def initialize(raw_key_options)
  @type = raw_key_options['type']
  @offset = raw_key_options['offset']
  @increment = raw_key_options['increment']
  @allow_user_keys = raw_key_options['allowUserKeys']
end