class Frontmatter::TemplateHandler
Public Class Methods
call(template, source)
click to toggle source
# File lib/frontmatter/template_handler.rb, line 3 def self.call(template, source) new(template, source).call end
new(template, source)
click to toggle source
# File lib/frontmatter/template_handler.rb, line 7 def initialize(template, source) @template = template @source = source end
Public Instance Methods
call()
click to toggle source
# File lib/frontmatter/template_handler.rb, line 12 def call handler_for_template.call(@template, source_without_yaml) end
handler_for_template()
click to toggle source
# File lib/frontmatter/template_handler.rb, line 16 def handler_for_template ApplicationController.new.view_paths.paths.first .send(:extract_handler_and_format_and_variant, path_without_yaml) .first end
last_line()
click to toggle source
# File lib/frontmatter/template_handler.rb, line 30 def last_line YAML.parse(@source).root.end_line end
path_without_yaml()
click to toggle source
# File lib/frontmatter/template_handler.rb, line 26 def path_without_yaml @template.short_identifier.sub(/.ya?ml\z/, '') end
source_without_yaml()
click to toggle source
# File lib/frontmatter/template_handler.rb, line 22 def source_without_yaml @source.lines[last_line+1...].join end