lib/picky/application.rb in picky-0.0.9 vs lib/picky/application.rb in picky-0.1.0

- old
+ new

@@ -1,40 +1,41 @@ +# The Picky application wherein the indexing and querying is defined. +# class Application - - # An application simply delegates to the routing to handle a request. - # - def self.routing - @routing ||= Routing.new + class << self + + # 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 - def self.call env - routing.call env - end - - # - # - def self.indexes &block - indexes_configuration.instance_eval &block - # TODO Uglyyyyyy. - ::Indexes.configuration = indexes_configuration - ::Indexes.setup # TODO Think about setup/reload. - end - def self.indexes_configuration - @indexes || reset_indexes - end - def self.reset_indexes - @indexes = Configuration::Indexes.new # Is instance a problem? - end - - # - # - def self.queries &block - queries_configuration.instance_eval &block - routing.freeze - end - def self.queries_configuration - @queries || reset_queries - end - def self.reset_queries - @queries = Configuration::Queries.new routing # Is instance a problem? - end - end \ No newline at end of file