Sha256: f5b39b0153502ac4621e59102533ebd7d1f91c2542a359e416600e7becb1dc01
Contents?: true
Size: 994 Bytes
Versions: 2
Compression:
Stored size: 994 Bytes
Contents
module Jekyll module Assets class Hook class UnknownHookError < RuntimeError def initialize(base, point) super "Unknown jekyll-assets hook point (#{point}) or base (#{base}) given." end end HOOK_POINTS = { :env => [ :pre_init, :post_init ] } class << self def all @_all ||= {} end def trigger(base, point, *args) if all[base][point] then all[base][point].map do |v| v.call(*args) end end end def point(base, point) all[base][point] ||= Set.new end def register(base, point, &block) if HOOK_POINTS.has_key?(base) && HOOK_POINTS[base].include?(point) all[base] ||= {} point(base, point) << \ block else raise UnknownHookError.new(base, point) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jekyll-assets-2.0.0.pre.beta2 | lib/jekyll/assets/hook.rb |
jekyll-assets-2.0.0.pre.beta1 | lib/jekyll/assets/hook.rb |