Class: Rox::Server::RoxOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/rox/server/rox_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dev_mode_key: nil, version: nil, fetch_interval: nil, logger: nil, impression_handler: nil, configuration_fetched_handler: nil, roxy_url: nil, self_managed_options: nil, network_configurations_options: nil, dynamic_property_rule_handler: nil) ⇒ RoxOptions

Returns a new instance of RoxOptions.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/rox/server/rox_options.rb', line 14

def initialize(
  dev_mode_key: nil,
  version: nil,
  fetch_interval: nil,
  logger: nil,
  impression_handler: nil,
  configuration_fetched_handler: nil,
  roxy_url: nil,
  self_managed_options: nil,
  network_configurations_options: nil,
  dynamic_property_rule_handler: nil
)
  @dev_mode_key = dev_mode_key || 'stam'
  @version = version || '0.0'

  @fetch_interval = if fetch_interval.nil?
                      60
                    else
                      [fetch_interval, 30].max
                    end

  Rox::Core::Logging.logger = logger || ServerLogger.new

  @impression_handler = impression_handler
  @configuration_fetched_handler = configuration_fetched_handler
  @roxy_url = roxy_url
  @self_managed_options = self_managed_options
  @network_configurations_options = network_configurations_options
  @dynamic_property_rule_handler = dynamic_property_rule_handler || proc do |prop_name, context|
    context ? context[prop_name] : nil
  end
end

Instance Attribute Details

#configuration_fetched_handlerObject (readonly)

Returns the value of attribute configuration_fetched_handler.



7
8
9
# File 'lib/rox/server/rox_options.rb', line 7

def configuration_fetched_handler
  @configuration_fetched_handler
end

#dev_mode_keyObject (readonly)

Returns the value of attribute dev_mode_key.



7
8
9
# File 'lib/rox/server/rox_options.rb', line 7

def dev_mode_key
  @dev_mode_key
end

#dynamic_property_rule_handlerObject (readonly)

Returns the value of attribute dynamic_property_rule_handler.



7
8
9
# File 'lib/rox/server/rox_options.rb', line 7

def dynamic_property_rule_handler
  @dynamic_property_rule_handler
end

#fetch_intervalObject (readonly)

Returns the value of attribute fetch_interval.



7
8
9
# File 'lib/rox/server/rox_options.rb', line 7

def fetch_interval
  @fetch_interval
end

#impression_handlerObject (readonly)

Returns the value of attribute impression_handler.



7
8
9
# File 'lib/rox/server/rox_options.rb', line 7

def impression_handler
  @impression_handler
end

#loggerObject (readonly)

Returns the value of attribute logger.



7
8
9
# File 'lib/rox/server/rox_options.rb', line 7

def logger
  @logger
end

#network_configurations_optionsObject (readonly)

Returns the value of attribute network_configurations_options.



7
8
9
# File 'lib/rox/server/rox_options.rb', line 7

def network_configurations_options
  @network_configurations_options
end

#roxy_urlObject (readonly)

Returns the value of attribute roxy_url.



7
8
9
# File 'lib/rox/server/rox_options.rb', line 7

def roxy_url
  @roxy_url
end

#self_managed_optionsObject (readonly)

Returns the value of attribute self_managed_options.



7
8
9
# File 'lib/rox/server/rox_options.rb', line 7

def self_managed_options
  @self_managed_options
end

#versionObject (readonly)

Returns the value of attribute version.



7
8
9
# File 'lib/rox/server/rox_options.rb', line 7

def version
  @version
end

Instance Method Details

#self_managed?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/rox/server/rox_options.rb', line 47

def self_managed?
  !@self_managed_options.nil?
end