Module: Bloggit

Defined in:
lib/bloggit/tag.rb,
lib/bloggit.rb,
lib/bloggit/page.rb,
lib/bloggit/post.rb,
lib/bloggit/hooks.rb,
lib/bloggit/media.rb,
lib/bloggit/plugin.rb,
lib/bloggit/checksum.rb,
lib/bloggit/template.rb,
lib/bloggit/publisher.rb,
lib/bloggit/commandline.rb,
lib/bloggit/text_formatter.rb

Overview

See Bloggit::Publisher

Defined Under Namespace

Modules: Checksum, Cmdline, TextFormatter Classes: Media, Page, Plugin, Post, Publisher, Server, Tag, Template

Constant Summary collapse

RELEASE_INFO =
[1, 0, 7]
VERSION =
RELEASE_INFO.join('.')

Class Method Summary collapse

Class Method Details

.fire_event(event, *args) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/bloggit/hooks.rb', line 12

def fire_event(event, *args)
  results = {}
  listeners.fetch(event, []).each do |block|
    res = block.call(*args)
    results.merge!(res) if res.is_a?( Hash )
  end
  results
end

.listenersObject



3
4
5
# File 'lib/bloggit/hooks.rb', line 3

def listeners
  @listeners ||= {}
end

.on_event(event, &block) ⇒ Object



7
8
9
10
# File 'lib/bloggit/hooks.rb', line 7

def on_event(event, &block)
  listeners[event] ||= []
  listeners[event] << block
end