Class: Couchbase::LookupInSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/couchbase/subdoc.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.


58
59
60
# File 'lib/couchbase/subdoc.rb', line 58

def path
  @path
end

#typeObject (readonly)

Returns the value of attribute type.


57
58
59
# File 'lib/couchbase/subdoc.rb', line 57

def type
  @type
end

Class Method Details

.count(path) ⇒ LookupInSpec

Counts the number of values at a given path in teh document

Parameters:

  • path (String)

    the path identifying where to count the values

Returns:

[View source]

44
45
46
# File 'lib/couchbase/subdoc.rb', line 44

def self.count(path)
  new(:count, path)
end

.exists(path) ⇒ LookupInSpec

Checks if a value at the given path exists in the document

Parameters:

  • path (String)

    the path to check if the field exists

Returns:

[View source]

36
37
38
# File 'lib/couchbase/subdoc.rb', line 36

def self.exists(path)
  new(:exists, path)
end

.get(path) ⇒ LookupInSpec

Fetches the content from a field (if present) at the given path

Parameters:

  • path (String, Symbol)

    the path identifying where to get the value. When path is a symbol, the library will try to expand it as macro.

Returns:

[View source]

21
22
23
24
25
26
27
28
29
30
# File 'lib/couchbase/subdoc.rb', line 21

def self.get(path)
  case path
  when Symbol
    new(:get, expand_macro(path))
  when ""
    new(:get_doc, "")
  else
    new(:get, path)
  end
end

Instance Method Details

#xattrObject

[View source]

48
49
50
51
# File 'lib/couchbase/subdoc.rb', line 48

def xattr
  @xattr = true
  self
end

#xattr?Boolean

Returns:

  • (Boolean)
[View source]

53
54
55
# File 'lib/couchbase/subdoc.rb', line 53

def xattr?
  @xattr
end