Module: MessageTrain

Defined in:
lib/message_train.rb,
lib/message_train/mixin.rb,
lib/message_train/engine.rb,
lib/message_train/version.rb,
lib/message_train/class_methods.rb,
lib/message_train/configuration.rb,
lib/generators/message_train/utils.rb,
lib/message_train/instance_methods.rb,
lib/generators/message_train/install/install_generator.rb

Overview

MessageTrain module

Defined Under Namespace

Modules: ClassMethods, Generators, InstanceMethods, Mixin Classes: Configuration, Engine, InstallGenerator

Constant Summary collapse

VERSION =
File.read(File.expand_path('../../../VERSION', __FILE__))

Class Method Summary collapse

Class Method Details

.configurationObject



17
18
19
# File 'lib/message_train/configuration.rb', line 17

def self.configuration
  @configuration ||= MessageTrain::Configuration.new
end

.configure(configuration = MessageTrain::Configuration.new) {|configuration| ... } ⇒ Object

Yields:



12
13
14
15
# File 'lib/message_train/configuration.rb', line 12

def self.configure(configuration = MessageTrain::Configuration.new)
  yield(configuration) if block_given?
  @configuration = configuration
end

.configure_table(table_sym, name, options) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/message_train/configuration.rb', line 21

def self.configure_table(table_sym, name, options)
  configure(@configuration) do |config|
    config.recipient_tables[table_sym] = name
    @conversions.each do |mixin_option_sym, configuration_name_sym|
      value = options[mixin_option_sym]
      next unless value.present?
      setting = config.send(configuration_name_sym)
      setting[table_sym] = value
      config.send("#{configuration_name_sym}=", setting)
    end
  end
end

.version_stringObject



5
6
7
# File 'lib/message_train/version.rb', line 5

def self.version_string
  "MessageTrain version #{MessageTrain::VERSION}"
end