Sha256: ae5130749e15a984866459de1e4cfd3b5bc8235b25e4640a1cf84e72857a1efa
Contents?: true
Size: 851 Bytes
Versions: 4
Compression:
Stored size: 851 Bytes
Contents
require 'jekyll_plugin_logger' # Sample Jekyll filter. module JekyllEvalFilter class << self attr_accessor :logger end self.logger = PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config) # This Jekyll filter evaluates the input string and returns the result. # Use it as a calculator or one-line Ruby program evaluator. # # @param input_string [String]. # @return [String] input string and the evaluation result. # @example Use like this: # {{ 'TODO: show typical input' | eval }} => "TODO: show output" def evaluate(input_string) input_string.strip! JekyllEvalFilter.logger.debug { "input_string=#{input_string}" } Kernel.eval input_string.strip end PluginMetaLogger.instance.logger.info { 'Loaded evaluate Liquid filter.' } end Liquid::Template.register_filter JekyllEvalFilter
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
jekyll_eval_filter-0.1.3 | lib/evaluate.rb |
jekyll_eval_filter-0.1.2 | lib/evaluate.rb |
jekyll_eval_filter-0.1.1 | lib/evaluate.rb |
jekyll_eval_filter-0.1.0 | lib/evaluate.rb |