Module: Restify::Global

Included in:
Restify
Defined in:
lib/restify/global.rb

Instance Method Summary collapse

Instance Method Details

#adapterObject



11
12
13
14
15
16
# File 'lib/restify/global.rb', line 11

def adapter
  @adapter ||= begin
    require 'restify/adapter/em'
    Restify::Adapter::EM.new
  end
end

#adapter=(adapter) ⇒ Object



18
19
20
# File 'lib/restify/global.rb', line 18

def adapter=(adapter)
  @adapter = adapter
end

#cacheObject



22
23
24
25
26
27
# File 'lib/restify/global.rb', line 22

def cache
  @cache ||= begin
    require 'active_support/cache'
    Restify::Cache.new store: ActiveSupport::Cache::MemoryStore.new
  end
end

#cache=(cache) ⇒ Object



29
30
31
# File 'lib/restify/global.rb', line 29

def cache=(cache)
  @cache = cache
end

#new(uri, **opts) ⇒ Object



5
6
7
8
9
# File 'lib/restify/global.rb', line 5

def new(uri, **opts)
  context = resolve_context uri, **opts

  Relation.new context, context.uri
end