Class: Rox::Server::RoxOptions
- Inherits:
-
Object
- Object
- Rox::Server::RoxOptions
- Includes:
- Core::Helpers::ApiKey
- Defined in:
- lib/rox/server/rox_options.rb
Constant Summary
Constants included from Core::Helpers::ApiKey
Core::Helpers::ApiKey::MONGO_API_KEY_PATTERN, Core::Helpers::ApiKey::UUID_API_KEY_PATTERN
Instance Attribute Summary collapse
-
#configuration_fetched_handler ⇒ Object
readonly
Returns the value of attribute configuration_fetched_handler.
-
#dev_mode_key ⇒ Object
readonly
Returns the value of attribute dev_mode_key.
-
#disable_signature_verification ⇒ Object
readonly
Returns the value of attribute disable_signature_verification.
-
#dynamic_property_rule_handler ⇒ Object
readonly
Returns the value of attribute dynamic_property_rule_handler.
-
#fetch_interval ⇒ Object
readonly
Returns the value of attribute fetch_interval.
-
#impression_handler ⇒ Object
readonly
Returns the value of attribute impression_handler.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#network_configurations_options ⇒ Object
readonly
Returns the value of attribute network_configurations_options.
-
#roxy_url ⇒ Object
readonly
Returns the value of attribute roxy_url.
-
#self_managed_options ⇒ Object
readonly
Returns the value of attribute self_managed_options.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #clone_with_options(options = {}) ⇒ Object
-
#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, disable_signature_verification: nil) ⇒ RoxOptions
constructor
A new instance of RoxOptions.
- #self_managed? ⇒ Boolean
Methods included from Core::Helpers::ApiKey
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, disable_signature_verification: nil) ⇒ RoxOptions
Returns a new instance of RoxOptions.
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 46 47 48 49 50 51 |
# File 'lib/rox/server/rox_options.rb', line 18 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, disable_signature_verification: 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 = @network_configurations_options = @dynamic_property_rule_handler = dynamic_property_rule_handler || proc do |prop_name, context| context ? context[prop_name] : nil end @disable_signature_verification = disable_signature_verification end |
Instance Attribute Details
#configuration_fetched_handler ⇒ Object (readonly)
Returns the value of attribute configuration_fetched_handler.
10 11 12 |
# File 'lib/rox/server/rox_options.rb', line 10 def configuration_fetched_handler @configuration_fetched_handler end |
#dev_mode_key ⇒ Object (readonly)
Returns the value of attribute dev_mode_key.
10 11 12 |
# File 'lib/rox/server/rox_options.rb', line 10 def dev_mode_key @dev_mode_key end |
#disable_signature_verification ⇒ Object (readonly)
Returns the value of attribute disable_signature_verification.
10 11 12 |
# File 'lib/rox/server/rox_options.rb', line 10 def disable_signature_verification @disable_signature_verification end |
#dynamic_property_rule_handler ⇒ Object (readonly)
Returns the value of attribute dynamic_property_rule_handler.
10 11 12 |
# File 'lib/rox/server/rox_options.rb', line 10 def dynamic_property_rule_handler @dynamic_property_rule_handler end |
#fetch_interval ⇒ Object (readonly)
Returns the value of attribute fetch_interval.
10 11 12 |
# File 'lib/rox/server/rox_options.rb', line 10 def fetch_interval @fetch_interval end |
#impression_handler ⇒ Object (readonly)
Returns the value of attribute impression_handler.
10 11 12 |
# File 'lib/rox/server/rox_options.rb', line 10 def impression_handler @impression_handler end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
10 11 12 |
# File 'lib/rox/server/rox_options.rb', line 10 def logger @logger end |
#network_configurations_options ⇒ Object (readonly)
Returns the value of attribute network_configurations_options.
10 11 12 |
# File 'lib/rox/server/rox_options.rb', line 10 def @network_configurations_options end |
#roxy_url ⇒ Object (readonly)
Returns the value of attribute roxy_url.
10 11 12 |
# File 'lib/rox/server/rox_options.rb', line 10 def roxy_url @roxy_url end |
#self_managed_options ⇒ Object (readonly)
Returns the value of attribute self_managed_options.
10 11 12 |
# File 'lib/rox/server/rox_options.rb', line 10 def @self_managed_options end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
10 11 12 |
# File 'lib/rox/server/rox_options.rb', line 10 def version @version end |
Instance Method Details
#clone_with_options(options = {}) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/rox/server/rox_options.rb', line 57 def ( = {}) # Check if any keys that are not present as attributes were given as params redundant_keys = .keys - valid_attributes # Filter options if there are such keys that are not present if !redundant_keys.empty? = .reduce({}) do |acc, (key, value)| acc[key] = value unless redundant_keys.include?(key) acc end end valid_attributes.each do |va| unless .key?(va) [va] = self.instance_variable_get("@#{va}".to_sym) end end self.class.new(**) end |
#self_managed? ⇒ Boolean
53 54 55 |
# File 'lib/rox/server/rox_options.rb', line 53 def self_managed? !@self_managed_options.nil? end |