Sha256: dff1d909f50c75b1ffc2411a9d77c6e0b23c0d984c67546ba04569077c33b7a6
Contents?: true
Size: 1014 Bytes
Versions: 3
Compression:
Stored size: 1014 Bytes
Contents
module Murlsh # Superclass for plugins. How plugins are registered. # # Hooks: # * add_pre - called before a new url is saved # run arguments (url, config hash) # * add_post - called after a new url is saved # run arguments (config hash) # * hostrec - called to post process the domain that shows after links # run arguments (domain, url, title) # * time - called to convert the time of a post into a string for display # run arguments (time) class Plugin # Called when a plugin class inherits from this class (the way plugins # are registered). def self.inherited(child) registered << child end # Get registered plugins by hook (add_pre, add_post, etc.) def self.hooks(name) matches = registered.select { |p| p::Hook == name }. sort { |a,b| a.to_s <=> b.to_s } if block_given? matches.each { |p| yield p } end matches end @registered = [] class << self; attr_reader :registered end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
murlsh-0.8.1 | lib/murlsh/plugin.rb |
murlsh-0.8.0 | lib/murlsh/plugin.rb |
murlsh-0.7.0 | lib/murlsh/plugin.rb |