Skip to content

Commit

Permalink
chore: rename functions
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexRiedler committed Dec 15, 2024
1 parent f2f9b44 commit 9f64d45
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/handlebars_assets/handlebars_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ def initialize(options)
end

def choose_engine(data)
if @template_path.is_haml?
if @template_path.haml?
Haml::Template.new(HandlebarsAssets::Config.haml_options) { data }
elsif @template_path.is_slim?
elsif @template_path.slim?
Slim::Template.new(HandlebarsAssets::Config.slim_options) { data }
else
NoOpEngine.new(data)
Expand All @@ -119,7 +119,7 @@ def compile(source)

# handle the case of multiple frameworks combined with ember
# DEFER: use extension setup for ember
if (HandlebarsAssets::Config.multiple_frameworks? && @template_path.is_ember?) ||
if (HandlebarsAssets::Config.multiple_frameworks? && @template_path.ember?) ||
(HandlebarsAssets::Config.ember? && !HandlebarsAssets::Config.multiple_frameworks?)
compile_ember(trim_source)
else
Expand All @@ -145,7 +145,7 @@ def compile_default(source)
if HandlebarsAssets::Config.amd?
handlebars_amd_path = HandlebarsAssets::Config.handlebars_amd_path
if HandlebarsAssets::Config.amd_with_template_namespace
if @template_path.is_partial?
if @template_path.partial?
unindent <<-PARTIAL
define(['#{handlebars_amd_path}'],function(Handlebars){
var t = #{template};
Expand All @@ -160,7 +160,7 @@ def compile_default(source)
});
TEMPLATE
end
elsif @template_path.is_partial?
elsif @template_path.partial?
unindent <<-PARTIAL
define(['#{handlebars_amd_path}'],function(Handlebars){
var t = #{template};
Expand All @@ -177,7 +177,7 @@ def compile_default(source)
});
TEMPLATE
end
elsif @template_path.is_partial?
elsif @template_path.partial?
unindent <<-PARTIAL
(function() {
Handlebars.registerPartial(#{@template_path.name}, #{template});
Expand Down Expand Up @@ -246,7 +246,7 @@ def name

def relative_path
path = @full_path.match(%r{.*#{HandlebarsAssets::Config.path_prefix}/((.*/)*([^.]*)).*$})[1]
if is_partial? && ::HandlebarsAssets::Config.chomp_underscore_for_partials?
if partial? && ::HandlebarsAssets::Config.chomp_underscore_for_partials?
# handle case if partial is in root level of template folder
path.gsub!(/^_/, '')
# handle case if partial is in a subfolder within the template folder
Expand Down

0 comments on commit 9f64d45

Please sign in to comment.