Module: Sinatra::Rabbit

Defined in:
lib/sinatra/rabbit.rb

Defined Under Namespace

Classes: Collection, DuplicateCollectionException, DuplicateOperationException, DuplicateParamException, Operation

Instance Method Summary collapse

Instance Method Details

#collection(name, &block) ⇒ Object

Create a new collection. NAME should be the pluralized name of the collection.

Adds a helper method #name_url which returns the URL to the :index operation on this collection.



207
208
209
210
211
212
213
# File 'lib/sinatra/rabbit.rb', line 207

def collection(name, &block)
  raise DuplicateCollectionException if collections[name]
  return unless Deltacloud::driver.has_collection?(name.to_sym)
  collections[name] = Collection.new(name, &block)
  collections[name].add_feature_params(Deltacloud::driver.features(name))
  collections[name].generate
end

#collectionsObject



198
199
200
# File 'lib/sinatra/rabbit.rb', line 198

def collections
  @collections ||= {}
end