module RailsKvsDriver::CommonMethods::Listable

common functions for keys.

Public Instance Methods

each() { |key, self| ... } click to toggle source

execute the block of code for each sorted_set.

@param &block [{|key, value| }] each the block of code for each key having string, and value.

# File lib/rails_kvs_driver/common_methods/listable.rb, line 8
def each
  keys.each {|key| yield key, self[key] }
end
empty?() click to toggle source

kvs check empty.

@return [Boolean] result.

# File lib/rails_kvs_driver/common_methods/listable.rb, line 15
def empty?
  (length<1)
end
has_key?(key) click to toggle source

check key in sorted set.

@param key [String] key name. @return [Boolean] result.

# File lib/rails_kvs_driver/common_methods/listable.rb, line 23
def has_key?(key)
  keys.include?(key)
end
length() click to toggle source

get length of sorted_set.

@return [Integer] length of keys.

# File lib/rails_kvs_driver/common_methods/listable.rb, line 30
def length
  keys.length
end
Also aliased as: size
size()
Alias for: length