Class: FaradayCage::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/faraday_cage/config.rb

Overview

Handles configuration of Faraday connection and server options.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



10
11
12
# File 'lib/faraday_cage/config.rb', line 10

def initialize
  self.default_host = 'http://example.com'
end

Instance Attribute Details

#appObject



14
15
16
17
18
# File 'lib/faraday_cage/config.rb', line 14

def app
  @app ||= begin
    default_rails_app if defined?(Rails)
  end
end

#default_hostObject

Returns the value of attribute default_host.



6
7
8
# File 'lib/faraday_cage/config.rb', line 6

def default_host
  @default_host
end

Instance Method Details

#middleware(&block) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/faraday_cage/config.rb', line 20

def middleware(&block)
  if block_given?
    @middleware = block
  else
    @middleware
  end
end