Module: Served::Backends

Defined in:
lib/served/backends.rb,
lib/served/backends/base.rb,
lib/served/backends/http.rb,
lib/served/backends/patron.rb,
lib/served/backends/httparty.rb

Defined Under Namespace

Classes: Base, HTTP, HTTParty, Patron

Class Method Summary collapse

Class Method Details

.[](backend) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/served/backends.rb', line 5

def self.[](backend)
  @backends ||= {
    http:     'HTTP',
    patron:   'Patron',
    httparty: 'HTTParty'
  }
  if @backends[backend]
    require_relative "backends/#{backend}"
    return const_get(@backends[backend].classify.to_sym)
  end
  require_relative 'backends/httparty'
  const_get(@backends[:httparty].classify.to_sym)
end