Sha256: 0b26565e29c19ed5dac53ba7a219964db7ad6970e972b7fe38a4fefc43e03cb3
Contents?: true
Size: 1.03 KB
Versions: 6
Compression:
Stored size: 1.03 KB
Contents
module Comatose class Drop < ::Liquid::Drop private :initialize def before_method(method) self.send(method.to_sym) rescue Comatose.logger.debug "Error calling #{method}: #{$!}" raise $! end class << self # Define a new Comatose::Drop by name def define(name, &block) d = Comatose::Drop.new d.instance_eval(&block) Comatose.registered_drops[name] = d rescue Comatose.logger.debug "Drop '#{name}' was not included: #{$!}" end end end class << self # Returns/initializes a hash for storing ComatoseDrops def registered_drops @registered_drops ||= {} end # Simple wrapper around the ProcessingContext.define method # I think Comatose.define_drop is probably simpler to remember too def define_drop(name, &block) Comatose::Drop.define(name, &block) end # Registers a 'filter' for Liquid use def register_filter(module_name) Liquid::Template.register_filter(module_name) end end end
Version data entries
6 entries across 6 versions & 1 rubygems