add init block support to #create and #create!

This commit is contained in:
Peter Williams 2011-05-31 16:03:08 -06:00
parent 4e19fdfdda
commit 2b9a5193b4

View file

@ -118,8 +118,8 @@ module CouchRest
# #
# ==== Returns # ==== Returns
# returns the reloaded document # returns the reloaded document
def create(attributes = {}) def create(attributes = {}, &block)
instance = new(attributes) instance = new(attributes, &block)
instance.create instance.create
instance instance
end end
@ -128,8 +128,8 @@ module CouchRest
# #
# ==== Returns # ==== Returns
# returns the reloaded document or raises an exception # returns the reloaded document or raises an exception
def create!(attributes = {}) def create!(attributes = {}, &block)
instance = new(attributes) instance = new(attributes, &block)
instance.create! instance.create!
instance instance
end end