Module: Rico

Defined in:
lib/rico.rb,
lib/rico/map.rb,
lib/rico/set.rb,
lib/rico/list.rb,
lib/rico/array.rb,
lib/rico/value.rb,
lib/rico/object.rb,
lib/rico/counter.rb,
lib/rico/version.rb,
lib/rico/resolver.rb,
lib/rico/collection.rb,
lib/rico/sorted_map.rb,
lib/rico/sorted_set.rb,
lib/rico/capped_sorted_map.rb

Defined Under Namespace

Modules: Object Classes: Array, CappedSortedMap, Collection, Counter, List, Map, Resolver, Set, SortedMap, SortedSet, Value

Constant Summary collapse

TYPES =
{
  "Array" => "array",
  "List" => "list",
  "Map" => "map",
  "Set" => "set",
  "SortedSet" => "sset",
  "SortedMap" => "smap",
  "Value" => "value"
}
VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.bucket(key) ⇒ Object



37
38
39
40
41
# File 'lib/rico.rb', line 37

def self.bucket(key)
  namespaced_key = [@namespace, key].flatten.select(&:present?).join(":")
  @bucket_cache ||= {}
  @bucket_cache[namespaced_key] ||= riak.bucket(namespaced_key)
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Rico)

    the object that the method was called on



33
34
35
# File 'lib/rico.rb', line 33

def self.configure
  yield self if block_given?
end

.namespaceObject



43
44
45
# File 'lib/rico.rb', line 43

def self.namespace
  @namespace
end

.namespace=(namespace) ⇒ Object



47
48
49
# File 'lib/rico.rb', line 47

def self.namespace=(namespace)
  @namespace = namespace
end

.optionsObject



51
52
53
# File 'lib/rico.rb', line 51

def self.options
  @options || {}
end

.options=(options) ⇒ Object



55
56
57
# File 'lib/rico.rb', line 55

def self.options=(options)
  @options = options
end

.riakObject



59
60
61
# File 'lib/rico.rb', line 59

def self.riak
  Thread.current[:riak] ||= Riak::Client.new(options)
end