module Sinatra::Rabbit::DSL
Public Class Methods
Source
# File lib/sinatra/rabbit/dsl.rb, line 49 def self.register_collection(c, &block) @collections ||= [] @collections << c end
Public Instance Methods
Source
# File lib/sinatra/rabbit/dsl.rb, line 58 def [](collection) collections.find { |c| c.collection_name == collection } end
Source
# File lib/sinatra/rabbit/dsl.rb, line 32 def collection(name, &block) return self[name] unless block_given? current_collection = BaseCollection.collection_class(name) do |c| c.base_class = self c.generate(name, &block) end collections << current_collection DSL << current_collection use current_collection end
Create DSL
wrapper for creating a new collection
Example:
collection :images do description "Images collection" operation :index do ... end end
Source
# File lib/sinatra/rabbit/dsl.rb, line 45 def collections @collections ||= [] end
Return all defined collections