Class: RFlow::Configuration::Connection
- Inherits:
-
ConfigurationItem
- Object
- ActiveRecord::Base
- ConfigurationItem
- RFlow::Configuration::Connection
- Includes:
- ActiveModel::Validations, UUIDKeyed
- Defined in:
- lib/rflow/configuration/connection.rb
Direct Known Subclasses
Defined Under Namespace
Classes: ConnectionInvalid
Class Method Summary collapse
-
.default_options ⇒ Object
Should return a hash of default options, where the keys are the option names and the values are either default option values or Procs that take a single connection argument.
-
.required_options ⇒ Object
Should return a list of require option names which will be used in validations.
Instance Method Summary collapse
- #all_required_options_present? ⇒ Boolean
-
#brokers ⇒ Object
By default, no broker processes are required to manage a connection.
- #merge_default_options! ⇒ Object
Methods included from UUIDKeyed
Class Method Details
.default_options ⇒ Object
Should return a hash of default options, where the keys are the option names and the values are either default option values or Procs that take a single connection argument. This allow defaults to use other parameters in the connection to construct the appropriate default value.
48 |
# File 'lib/rflow/configuration/connection.rb', line 48 def self.; {}; end |
.required_options ⇒ Object
Should return a list of require option names which will be used in validations. To be overridden.
41 |
# File 'lib/rflow/configuration/connection.rb', line 41 def self.; []; end |
Instance Method Details
#all_required_options_present? ⇒ Boolean
24 25 26 27 28 29 30 |
# File 'lib/rflow/configuration/connection.rb', line 24 def self.class..each do |option_name| unless self..include? option_name.to_s errors.add(:options, "must include #{option_name} for #{self.class.to_s}") end end end |
#brokers ⇒ Object
By default, no broker processes are required to manage a connection.
51 |
# File 'lib/rflow/configuration/connection.rb', line 51 def brokers; []; end |
#merge_default_options! ⇒ Object
32 33 34 35 36 37 |
# File 'lib/rflow/configuration/connection.rb', line 32 def self. ||= {} self.class..each do |name, default_value_or_proc| self.[name.to_s] ||= default_value_or_proc.is_a?(Proc) ? default_value_or_proc.call(self) : default_value_or_proc end end |