module Sinatra::Partial::Private
This is here to make testing the private code easier while not including it in the helpers.
Public Class Methods
partial_expand_path(partial_path, underscores=false)
click to toggle source
This gets the path to the template, taking into account whether leading underscores are needed.
@private param [String] partial_path param [true,false,nil] underscores Defaults to false
# File lib/sinatra/partial.rb, line 15 def self.partial_expand_path(partial_path, underscores=false) underscores ||= false dirs, base = File.dirname(partial_path), File.basename(partial_path) base.insert(0, "_") if underscores xs = dirs == "." ? [base] : [dirs, base] File.join(xs).to_sym end
partial_local(partial_path)
click to toggle source
This takes the name of the local from the template's name, and corrects local by removing leading underscore if it's there. @private param [String] partial_path
# File lib/sinatra/partial.rb, line 26 def self.partial_local(partial_path) partial_path = partial_path[1..-1] if partial_path.start_with? "_" File.basename(partial_path).to_sym end