Sha256: 18e824670c419086ca046fdcdd0a387b9970fef3ac3b85981529f83d5f2dd652
Contents?: true
Size: 740 Bytes
Versions: 7
Compression:
Stored size: 740 Bytes
Contents
module Adapters # 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. # @@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) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems