Module: CouchPillow

Defined in:
lib/couchpillow.rb,
lib/couchpillow/errors.rb,
lib/couchpillow/helper.rb,
lib/couchpillow/boolean.rb,
lib/couchpillow/version.rb,
lib/couchpillow/document.rb,
lib/couchpillow/directives/type.rb,
lib/couchpillow/directives/rename.rb,
lib/couchpillow/directives/migrate.rb,
lib/couchpillow/directives/multi_db.rb,
lib/couchpillow/directives/attribute.rb,
lib/couchpillow/directives/type_prefix.rb

Defined Under Namespace

Modules: AttributeDirective, MigrateDirective, MultiDBDirective, RenameDirective, TypeDirective, TypePrefixDirective Classes: Attribute, Boolean, CASError, Document, ValidationError

Constant Summary collapse

GEM_NAME =
"couchpillow"
NAME =
"CouchPillow"
VERSION =
"0.4.9"

Class Method Summary collapse

Class Method Details

.dbObject



12
13
14
# File 'lib/couchpillow.rb', line 12

def self.db
  @db || nil
end

.db=(driver) ⇒ Object



8
9
10
# File 'lib/couchpillow.rb', line 8

def self.db= driver
  @db = driver
end

.sanitize(value) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/couchpillow/helper.rb', line 11

def self.sanitize value
  sanitized = nil
  if value.class == Hash
    sanitized = {}
    value.each do |k, v|
      sanitized[k] = sanitize(v)
    end
  elsif value.class == Array
    sanitized = []
    value.each do |e|
      sanitized << sanitize(e)
    end
  else
    sanitized = value
  end
  sanitized
end

.symbolize(hash) ⇒ Object



3
4
5
6
7
8
# File 'lib/couchpillow/helper.rb', line 3

def self.symbolize hash
  hash.inject({}) do |memo,(k,v)|
    memo[k.to_sym] = sanitize(v)
    memo
  end
end