lib/picky/adapters/rack.rb in picky-2.7.0 vs lib/picky/adapters/rack.rb in picky-3.0.0.pre1

- old
+ new

@@ -1,30 +1,34 @@ -module Adapters +module Picky - # This is an adapter that is plugged into a Rack outlet. - # - # It looks at what is given to it and generate an appropriate - # adapter for it. - # - # For example, if you give it a query, it will extract the query param etc. - # and call search_with_text on it if it is called by Rack. - # - # Usage: - # Adapters::Rack.app_for(thing, options) - # - module Rack - - # Generates the appropriate app for Rack. + module Adapters + + # This is an adapter that is plugged into a Rack outlet. # - @@mapping = { - :search_with_text => Query, - :parameters => LiveParameters - } - def self.app_for thing, options = {} - @@mapping.each_pair do |method, adapter| - return adapter.new(thing).to_app(options) if thing.respond_to?(method) + # It looks at what is given to it and generate an appropriate + # adapter for it. + # + # For example, if you give it a query, it will extract the query param etc. + # and call search_with_text on it if it is called by Rack. + # + # Usage: + # Adapters::Rack.app_for(thing, options) + # + module Rack + + # Generates the appropriate app for Rack. + # + @@mapping = { + :search_with_text => Search, + :parameters => LiveParameters + } + def self.app_for thing, options = {} + @@mapping.each_pair do |method, adapter| + return adapter.new(thing).to_app(options) if thing.respond_to?(method) + end end + end - + end end \ No newline at end of file