Class: HandlebarsAssets::HandlebarsTemplate::TemplatePath
- Inherits:
-
Object
- Object
- HandlebarsAssets::HandlebarsTemplate::TemplatePath
- Defined in:
- lib/handlebars_assets/handlebars_template.rb
Instance Method Summary collapse
-
#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
#is_ember? ⇒ Boolean
177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 177 def is_ember? result = false ::HandlebarsAssets::Config.ember_extensions.each do |ext| if ext.start_with? '.' ext = '\\#{ext}' result ||= !(@full_path =~ /#{ext}(\..*)*$/).nil? else result ||= !(@full_path =~ /\.#{ext}(\..*)*$/).nil? end end result end |
#is_haml? ⇒ Boolean
147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 147 def is_haml? result = false ::HandlebarsAssets::Config..each do |ext| if ext.start_with? '.' ext = '\\#{ext}' result ||= !(@full_path =~ /#{ext}(\..*)*$/).nil? else result ||= !(@full_path =~ /\.#{ext}(\..*)*$/).nil? end end result end |
#is_partial? ⇒ Boolean
173 174 175 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 173 def is_partial? @full_path.gsub(%r{.*/}, '').start_with?('_') end |
#is_slim? ⇒ Boolean
160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 160 def is_slim? result = false ::HandlebarsAssets::Config..each do |ext| if ext.start_with? '.' ext = '\\#{ext}' result ||= !(@full_path =~ /#{ext}(\..*)*$/).nil? else result ||= !(@full_path =~ /\.#{ext}(\..*)*$/).nil? end end result end |
#name ⇒ Object
190 191 192 |
# File 'lib/handlebars_assets/handlebars_template.rb', line 190 def name template_name end |