Sha256: 5e39b1176b1f54cad31623b619ba7fb33fee1c7e9ab85d18f9a9513d8c4900b6

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

# The Picky application wherein the indexing and querying is defined.
#
class Application
  class << self
    
    # Finalize the subclass as soon as it
    # has finished loading.
    #
    # Note: finalize finalizes the routes.
    #
    def inherited app
      @apps ||= []
      @apps << app
    end
    def finalize_apps
      @apps.each &:finalize
    end
    
    # An application simply delegates to the routing to handle a request.
    #
    def call env
      routing.call env
    end
    
    # Freezes the routes.
    #
    def finalize
      routing.freeze
    end
    def routing
      @routing ||= Routing.new
    end
    # Routes.
    #
    delegate :route, :root, :to => :routing
    
    # TODO Rename to default_indexing?
    #
    def indexing
      @indexing ||= Configuration::Indexes.new
    end
    def index *args
      self.type *args
    end
    delegate :type, :field, :to => :indexing
    
    # TODO Rename to default_querying?
    #
    def querying
      @queries ||= Configuration::Queries.new
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
picky-0.9.3 lib/picky/application.rb
picky-0.9.2 lib/picky/application.rb
picky-0.9.1 lib/picky/application.rb
picky-0.9.0 lib/picky/application.rb