Sha256: 773a3f95be0fc2627c662079bbfaf95db3183f9ad900a487d1348fb62442df60

Contents?: true

Size: 984 Bytes

Versions: 4

Compression:

Stored size: 984 Bytes

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
    
    # 
    #
    def indexing
      @indexing ||= Configuration::Indexes.new
    end
    def index *args
      self.type *args
    end
    delegate :type, :field, :to => :indexing
    
    #
    #
    def querying
      @queries ||= Configuration::Queries.new
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
picky-0.3.0 lib/picky/application.rb
picky-0.2.4 lib/picky/application.rb
picky-0.2.3 lib/picky/application.rb
picky-0.2.2 lib/picky/application.rb