class Jekyll::Tilt::Processor
Public Class Methods
find_for(ext)
click to toggle source
– Finds the const that handles an ext @return [Array<Object>] –
# File lib/jekyll/tilt/processor.rb, line 40 def self.find_for(ext) inherited.select do |v| v.matches(ext) end end
for_ext(ext)
click to toggle source
– Allows you to set an extension @note We will create the Jekyll
shims rubocop:disable Metrics/LineLength @return [nil] –
# File lib/jekyll/tilt/processor.rb, line 27 def self.for_ext(ext) ext = ext.gsub(%r!^\.!, "") k = const_set(:Converter, Class.new(Converter)) send(:define_singleton_method, :matches) { |e| e == ext || e == ".#{ext}" } k.send(:define_method, :matches) { |e| e == ext || e == ".#{ext}" } k.send(:define_method, :output_ext) { |*| ".html" } k.send(:define_method, :convert) { |c| c } end
inherited(const = nil)
click to toggle source
– Allows us to track inherited @return [Array<Object>] –
# File lib/jekyll/tilt/processor.rb, line 14 def self.inherited(const = nil) return @inherited unless const @inherited |= [ const, ] end
run_for(out, ext:, var: {})
click to toggle source
– Runs the consts on the content @param out [String] the content to output @return [String] –
# File lib/jekyll/tilt/processor.rb, line 51 def self.run_for(out, ext:, var: {}) find_for(ext).each do |v| out = v.run_for(out, **var) end out end