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.
206 207 208 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 206 def initialize(path) @full_path = path end |
Instance Method Details
#check_extension(ext) ⇒ Object
210 211 212 213 214 215 216 217 218 219 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 210 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
237 238 239 240 241 242 243 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 237 def is_ember? result = false ::HandlebarsAssets::Config.ember_extensions.each do |ext| result ||= check_extension(ext) end result end |
#is_haml? ⇒ Boolean
221 222 223 224 225 226 227 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 221 def is_haml? result = false ::HandlebarsAssets::Config..each do |ext| result ||= check_extension(ext) end result end |
#is_partial? ⇒ Boolean
245 246 247 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 245 def is_partial? @full_path.gsub(%r{.*/}, '').start_with?('_') end |
#is_slim? ⇒ Boolean
229 230 231 232 233 234 235 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 229 def is_slim? result = false ::HandlebarsAssets::Config..each do |ext| result ||= check_extension(ext) end result end |
#name ⇒ Object
249 250 251 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 249 def name template_name end |