Class: HandlebarsAssets::HandlebarsRenderer::TemplatePath
- Inherits:
-
Object
- Object
- HandlebarsAssets::HandlebarsRenderer::TemplatePath
- Defined in:
- lib/handlebars_assets/handlebars_template.rb
Instance Method Summary collapse
- #check_extension(ext) ⇒ Object
-
#initialize(path) ⇒ TemplatePath
constructor
A new instance of TemplatePath.
- #is_ember? ⇒ Boolean
- #is_haml? ⇒ Boolean
- #is_partial? ⇒ Boolean
- #is_slim? ⇒ Boolean
- #name ⇒ Object
Constructor Details
#initialize(path) ⇒ TemplatePath
Returns a new instance of TemplatePath.
202 203 204 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 202 def initialize(path) @full_path = path end |
Instance Method Details
#check_extension(ext) ⇒ Object
206 207 208 209 210 211 212 213 214 215 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 206 def check_extension(ext) result = false if ext.start_with? '.' ext = "\\#{ext}" result ||= !(@full_path =~ /#{ext}(\..*)*$/).nil? else result ||= !(@full_path =~ /\.#{ext}(\..*)*$/).nil? end result end |
#is_ember? ⇒ Boolean
233 234 235 236 237 238 239 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 233 def is_ember? result = false ::HandlebarsAssets::Config.ember_extensions.each do |ext| result ||= check_extension(ext) end result end |
#is_haml? ⇒ Boolean
217 218 219 220 221 222 223 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 217 def is_haml? result = false ::HandlebarsAssets::Config..each do |ext| result ||= check_extension(ext) end result end |
#is_partial? ⇒ Boolean
241 242 243 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 241 def is_partial? @full_path.gsub(%r{.*/}, '').start_with?('_') end |
#is_slim? ⇒ Boolean
225 226 227 228 229 230 231 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 225 def is_slim? result = false ::HandlebarsAssets::Config..each do |ext| result ||= check_extension(ext) end result end |
#name ⇒ Object
245 246 247 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 245 def name template_name end |