class RFlow::Configuration::Connection

Represents a component-to-component connection in the SQLite database.

Public Class Methods

default_options() click to toggle source

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. To be overridden by subclasses. @return [Hash]

# File lib/rflow/configuration/connection.rb, line 65
def self.default_options; {}; end
required_options() click to toggle source

Should return a list of require option names which will be used in validations. To be overridden by subclasses. @return [Array<String>]

# File lib/rflow/configuration/connection.rb, line 56
def self.required_options; []; end

Public Instance Methods

all_required_options_present?() click to toggle source

@!visibility private

# File lib/rflow/configuration/connection.rb, line 37
def all_required_options_present?
  self.class.required_options.each do |option_name|
    unless self.options.include? option_name.to_s
      errors.add(:options, "must include #{option_name} for #{self.class.to_s}")
    end
  end
end
brokers() click to toggle source

By default, no broker processes are required to manage a connection. To be overridden by subclasses. @return [Array<Broker>]

# File lib/rflow/configuration/connection.rb, line 70
def brokers; []; end
merge_default_options!() click to toggle source

@!visibility private

# File lib/rflow/configuration/connection.rb, line 46
def merge_default_options!
  self.options ||= {}
  self.class.default_options.each do |name, default_value_or_proc|
    self.options[name.to_s] ||= default_value_or_proc.is_a?(Proc) ? default_value_or_proc.call(self) : default_value_or_proc
  end
end