Class: Elastictastic::Adapter

Inherits:
Object
  • Object
show all
Includes:
TransportMethods
Defined in:
lib/elastictastic/adapter.rb

Direct Known Subclasses

ExconAdapter, NetHttpAdapter

Defined Under Namespace

Classes: Response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TransportMethods

#delete, #get, #head, #post, #put

Constructor Details

#initialize(host, options = {}) ⇒ Adapter

Returns a new instance of Adapter.



19
20
21
22
23
# File 'lib/elastictastic/adapter.rb', line 19

def initialize(host, options = {})
  @host = host
  @request_timeout = options[:request_timeout]
  @connect_timeout = options[:connect_timeout]
end

Class Method Details

.[](str) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/elastictastic/adapter.rb', line 11

def self.[](str)
  case str
  when nil then NetHttpAdapter
  when /^[a-z_]+$/ then Elastictastic.const_get("#{str.to_s.classify}Adapter")
  else str.constantize
  end
end