Sha256: c88c54a291268fd0c01085196cada1b206edb343872b68e337bfe129dbab7f58

Contents?: true

Size: 918 Bytes

Versions: 2

Compression:

Stored size: 918 Bytes

Contents

class Application
  
  # An application simply delegates to the routing to handle a request.
  #
  def self.routing
    @routing ||= Routing.new
  end
  def self.call env
    routing.call env
  end
  
  # TODO Multiple indexes?
  #
  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
  
  # TODO Multiple Queries?
  #
  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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
picky-0.0.3 lib/picky/application.rb
picky-0.0.2 lib/picky/application.rb