Module: Drudgery

Defined in:
lib/drudgery.rb,
lib/drudgery/job.rb,
lib/drudgery/manager.rb,
lib/drudgery/version.rb,
lib/drudgery/transformer.rb,
lib/drudgery/loaders/csv_loader.rb,
lib/drudgery/loaders/sqlite3_loader.rb,
lib/drudgery/extractors/csv_extractor.rb,
lib/drudgery/extractors/sqlite3_extractor.rb,
lib/drudgery/loaders/active_record_loader.rb,
lib/drudgery/extractors/active_record_extractor.rb,
lib/drudgery/loaders/active_record_import_loader.rb

Defined Under Namespace

Modules: Extractors, Loaders Classes: Job, Manager, Transformer

Constant Summary collapse

VERSION =
'0.2.1'

Class Method Summary collapse

Class Method Details

.listenersObject



19
20
21
# File 'lib/drudgery.rb', line 19

def listeners
  @listeners ||= Hash.new { |hash, key| hash[key] = [] }
end

.notify(event, *args) ⇒ Object



31
32
33
34
35
# File 'lib/drudgery.rb', line 31

def notify(event, *args)
  listeners[event].each do |listener|
    listener.call(*args)
  end
end

.subscribe(event, &block) ⇒ Object



23
24
25
# File 'lib/drudgery.rb', line 23

def subscribe(event, &block)
  listeners[event] << block
end

.unsubscribe(event) ⇒ Object



27
28
29
# File 'lib/drudgery.rb', line 27

def unsubscribe(event)
  listeners[event].clear
end