Module: Diversion::Configurable

Extended by:
Forwardable
Included in:
Diversion, Client
Defined in:
lib/diversion/configurable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#encode_urisObject

Returns the value of attribute encode_uris.



7
8
9
# File 'lib/diversion/configurable.rb', line 7

def encode_uris
  @encode_uris
end

#hostObject

Returns the value of attribute host.



7
8
9
# File 'lib/diversion/configurable.rb', line 7

def host
  @host
end

#pathObject

Returns the value of attribute path.



7
8
9
# File 'lib/diversion/configurable.rb', line 7

def path
  @path
end

#portObject

Returns the value of attribute port.



7
8
9
# File 'lib/diversion/configurable.rb', line 7

def port
  @port
end

#sign_keyObject

Returns the value of attribute sign_key.



7
8
9
# File 'lib/diversion/configurable.rb', line 7

def sign_key
  @sign_key
end

#sign_lengthObject

Returns the value of attribute sign_length.



7
8
9
# File 'lib/diversion/configurable.rb', line 7

def sign_length
  @sign_length
end

#url_decodingObject

Returns the value of attribute url_decoding.



8
9
10
# File 'lib/diversion/configurable.rb', line 8

def url_decoding
  @url_decoding
end

#url_encodingObject

Returns the value of attribute url_encoding.



8
9
10
# File 'lib/diversion/configurable.rb', line 8

def url_encoding
  @url_encoding
end

Class Method Details

.keysObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/diversion/configurable.rb', line 13

def keys
  @keys ||= [
    :host,
    :port,
    :path,
    :sign_key,
    :sign_length,
    :encode_uris,
    :url_encoding,
    :url_decoding
  ]
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



28
29
30
31
32
# File 'lib/diversion/configurable.rb', line 28

def configure
  yield self
  validate_configuration!
  self
end

#reset!Object Also known as: setup



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/diversion/configurable.rb', line 34

def reset!
  @host = 'http://localhost.domain'
  @port = 80
  @path = '/redirect/1/'
  @sign_length = 0
  @sign_key = nil
  @encode_uris = ['http','https']
  @url_encoding = Encode::Params
  @url_decoding = Decode::Params
  validate_configuration!
  self
end