Class: HandlebarsAssets::HandlebarsTemplate::TemplatePath
- Inherits:
-
Object
- Object
- HandlebarsAssets::HandlebarsTemplate::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.
143 144 145 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 143 def initialize(path) @full_path = path end |
Instance Method Details
#check_extension(ext) ⇒ Object
147 148 149 150 151 152 153 154 155 156 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 147 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
174 175 176 177 178 179 180 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 174 def is_ember? result = false ::HandlebarsAssets::Config.ember_extensions.each do |ext| result ||= check_extension(ext) end result end |
#is_haml? ⇒ Boolean
158 159 160 161 162 163 164 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 158 def is_haml? result = false ::HandlebarsAssets::Config..each do |ext| result ||= check_extension(ext) end result end |
#is_partial? ⇒ Boolean
182 183 184 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 182 def is_partial? @full_path.gsub(%r{.*/}, '').start_with?('_') end |
#is_slim? ⇒ Boolean
166 167 168 169 170 171 172 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 166 def is_slim? result = false ::HandlebarsAssets::Config..each do |ext| result ||= check_extension(ext) end result end |
#name ⇒ Object
186 187 188 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 186 def name template_name end |