Module: Chronicle::ETL::Configurable::InstanceMethods

Defined in:
lib/chronicle/etl/configurable.rb

Overview

Instance methods for classes that have Configurable mixed in

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



51
52
53
# File 'lib/chronicle/etl/configurable.rb', line 51

def config
  @config
end

Class Method Details

.settingsObject

Name of all settings available to this class



72
73
74
# File 'lib/chronicle/etl/configurable.rb', line 72

def self.settings
  self.class.all_settings.keys
end

Instance Method Details

#apply_options(options) ⇒ Object

Take given options and apply them to this class's settings and make them available in @config and validates that they conform to setting rules



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/chronicle/etl/configurable.rb', line 56

def apply_options(options)
  options.transform_keys!(&:to_sym)

  options.each do |name, value|
    setting = self.class.all_settings[name]

    # Do nothing with a given option if it's not a connector setting
    next unless setting

    @config[name] = coerced_value(setting, name, value)
  end
  validate_config
  options
end