class Clacks::Configurator

Constants

DEFAULTS

Attributes

config_file[RW]
map[RW]

Public Class Methods

new(config_file = nil) click to toggle source
# File lib/clacks/configurator.rb, line 14
def initialize(config_file = nil)
  self.map = Hash.new
  map.merge!(DEFAULTS)
  self.config_file = config_file
  instance_eval(File.read(config_file), config_file) if config_file
end

Public Instance Methods

after_initialize(*args, &block) click to toggle source
# File lib/clacks/configurator.rb, line 73
def after_initialize(*args, &block)
  set_hook(:after_initialize, 0, block_given? ? block : args[0])
end
find_options(hash) click to toggle source
# File lib/clacks/configurator.rb, line 65
def find_options(hash)
  set_hash(:find_options, hash)
end
imap(hash) click to toggle source
# File lib/clacks/configurator.rb, line 61
def imap(hash)
  set_hash(:imap, hash)
end
logger(obj) click to toggle source

Sets the Logger-like object. The default Logger will log its output to Rails.logger if you're running within a rails environment, otherwise it will output to the path specified by stdout_path.

# File lib/clacks/configurator.rb, line 37
def logger(obj)
  %w(debug info warn error fatal level).each do |m|
    next if obj.respond_to?(m)
    raise ArgumentError, "logger #{obj} does not respond to method #{m}"
  end
  map[:logger] = obj
end
on_mail(*args, &block) click to toggle source
# File lib/clacks/configurator.rb, line 69
def on_mail(*args, &block)
  set_hook(:on_mail, 1, block_given? ? block : args[0])
end
pid(path) click to toggle source
# File lib/clacks/configurator.rb, line 29
def pid(path)
  set_path(:pid, path)
end
poll_interval(value) click to toggle source
# File lib/clacks/configurator.rb, line 25
def poll_interval(value)
  map[:poll_interval] = value.to_i
end
pop3(hash) click to toggle source
# File lib/clacks/configurator.rb, line 57
def pop3(hash)
  set_hash(:pop3, hash)
end
stderr_path(path) click to toggle source

If you're running Clacks daemonized, then you must specify a path to prevent error messages from going to /dev/null.

# File lib/clacks/configurator.rb, line 53
def stderr_path(path)
  set_path(:stderr_path, path)
end
stdout_path(path) click to toggle source

If you're running Clacks daemonized, then you must specify a path to prevent error messages from going to /dev/null.

# File lib/clacks/configurator.rb, line 47
def stdout_path(path)
  set_path(:stdout_path, path)
end