Sha256: 937adddc8539011d9db2060d27c04f3c2812c032bb2c3184ebbe8e7f4b91b644
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
# Author:: Joe Winter <jwinter@jwinter.org> # Copyright:: 2013 jwinter.org # Author:: Mike Evans <mike@urlgonomics.com> # Copyright:: 2013 Urlgonomics LLC. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # module Couchbase::Operations module Fetch def fetch(key, set_options = {}, &block) raise ArgumentError('Must pass a block to #fetch') unless block_given? get(key, :quiet => false) rescue Couchbase::Error::NotFound yield(block).tap {|value| set(key, value, set_options) } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
couchbase-jruby-client-0.1.7-java | lib/couchbase/operations/fetch.rb |
couchbase-jruby-client-0.1.6-java | lib/couchbase/operations/fetch.rb |