Module: RobustServerSocket::Configuration

Included in:
RobustServerSocket
Defined in:
lib/robust_server_socket/configuration.rb

Constant Summary collapse

MIN_KEY_SIZE =
2048

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



5
6
7
# File 'lib/robust_server_socket/configuration.rb', line 5

def configuration
  @configuration
end

#configuredObject (readonly)

Returns the value of attribute configured.



5
6
7
# File 'lib/robust_server_socket/configuration.rb', line 5

def configured
  @configured
end

Instance Method Details

#_push_bang_modules_check_code(code) ⇒ Object



11
12
13
# File 'lib/robust_server_socket/configuration.rb', line 11

def _push_bang_modules_check_code(code)
  configuration._bang_modules_check_rows.push(code)
end

#_push_modules_check_code(code) ⇒ Object



7
8
9
# File 'lib/robust_server_socket/configuration.rb', line 7

def _push_modules_check_code(code)
  configuration._modules_check_rows.push(code)
end

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

Yields:



15
16
17
18
19
20
21
# File 'lib/robust_server_socket/configuration.rb', line 15

def configure
  @configuration ||= ConfigStore.new
  yield(configuration)
  validate_key_security!

  @configured = true
end

#configured?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/robust_server_socket/configuration.rb', line 34

def configured?
  !!@configured && correct_configuration?
end

#correct_configuration?Boolean

rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity

Returns:

  • (Boolean)


23
24
25
26
27
28
29
30
31
32
# File 'lib/robust_server_socket/configuration.rb', line 23

def correct_configuration? # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
  configuration.allowed_services.is_a?(Array) &&
    configuration.allowed_services.any? &&
    configuration.private_key.is_a?(String) &&
    !configuration.private_key.empty? &&
    configuration.token_expiration_time.is_a?(Integer) &&
    configuration.token_expiration_time.positive? &&
    configuration.redis_url.is_a?(String) &&
    !configuration.redis_url.empty?
end