Class: Libcouchbase::DesignDoc

Inherits:
Object
  • Object
show all
Defined in:
lib/libcouchbase/design_docs.rb

Instance Method Summary collapse

Constructor Details

#initialize(id, row, bucket, connection, result_meth) ⇒ DesignDoc

Returns a new instance of DesignDoc.



56
57
58
59
60
61
62
# File 'lib/libcouchbase/design_docs.rb', line 56

def initialize(id, row, bucket, connection, result_meth)
    @connection = connection
    @result = result_meth
    @bucket = bucket
    @row = row
    @id = id
end

Instance Method Details

#view(name, extended: false, **opts, &blk) ⇒ Object Also known as: []



68
69
70
71
72
73
74
75
76
# File 'lib/libcouchbase/design_docs.rb', line 68

def view(name, extended: false, **opts, &blk)
    name = name.to_sym
    entry = @row[:json][:views][name]
    if entry
        @bucket.view(@id, name, **opts, &blk)
    else
        nil
    end
end

#view_configObject



79
80
81
# File 'lib/libcouchbase/design_docs.rb', line 79

def view_config
    @row[:json][:views]
end

#viewsObject



64
65
66
# File 'lib/libcouchbase/design_docs.rb', line 64

def views
    @row[:json][:views].keys
end