Class: TCPClient::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/tcp-client/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
15
# File 'lib/tcp-client/configuration.rb', line 12

def initialize
  @buffered = @keep_alive = @reverse_lookup = true
  self.timeout = @ssl_params = nil
end

Instance Attribute Details

#bufferedObject

Returns the value of attribute buffered.



9
10
11
# File 'lib/tcp-client/configuration.rb', line 9

def buffered
  @buffered
end

#keep_aliveObject

Returns the value of attribute keep_alive.



9
10
11
# File 'lib/tcp-client/configuration.rb', line 9

def keep_alive
  @keep_alive
end

#reverse_lookupObject

Returns the value of attribute reverse_lookup.



9
10
11
# File 'lib/tcp-client/configuration.rb', line 9

def reverse_lookup
  @reverse_lookup
end

#ssl_paramsObject

Returns the value of attribute ssl_params.



10
11
12
# File 'lib/tcp-client/configuration.rb', line 10

def ssl_params
  @ssl_params
end

Class Method Details

.create {|ret| ... } ⇒ Object

Yields:

  • (ret)


3
4
5
6
7
# File 'lib/tcp-client/configuration.rb', line 3

def self.create
  ret = new
  yield(ret) if block_given?
  ret
end

Instance Method Details

#connect_timeoutObject



44
45
46
# File 'lib/tcp-client/configuration.rb', line 44

def connect_timeout
  @connect_timeout || @timeout
end

#connect_timeout=(seconds) ⇒ Object



48
49
50
# File 'lib/tcp-client/configuration.rb', line 48

def connect_timeout=(seconds)
  @connect_timeout = seconds(seconds)
end

#read_timeoutObject



60
61
62
# File 'lib/tcp-client/configuration.rb', line 60

def read_timeout
  @read_timeout || @timeout
end

#read_timeout=(seconds) ⇒ Object



64
65
66
# File 'lib/tcp-client/configuration.rb', line 64

def read_timeout=(seconds)
  @read_timeout = seconds(seconds)
end

#ssl=(yn) ⇒ Object



21
22
23
24
25
# File 'lib/tcp-client/configuration.rb', line 21

def ssl=(yn)
  return @ssl_params = nil unless yn
  return @ssl_params = yn if Hash === yn
  @ssl_params ||= {}
end

#ssl?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/tcp-client/configuration.rb', line 17

def ssl?
  @ssl_params ? true : false
end

#timeout=(seconds) ⇒ Object



39
40
41
42
# File 'lib/tcp-client/configuration.rb', line 39

def timeout=(seconds)
  @timeout = seconds(seconds)
  @connect_timeout = @write_timeout = @read_timeout = nil
end

#write_timeoutObject



52
53
54
# File 'lib/tcp-client/configuration.rb', line 52

def write_timeout
  @write_timeout || @timeout
end

#write_timeout=(seconds) ⇒ Object



56
57
58
# File 'lib/tcp-client/configuration.rb', line 56

def write_timeout=(seconds)
  @write_timeout = seconds(seconds)
end