Class: HandlebarsAssets::TiltHandlebars::TemplatePath

Inherits:
Object
  • Object
show all
Defined in:
lib/handlebars_assets/tilt_handlebars.rb

Instance Method Summary collapse

Constructor Details

#initialize(scope) ⇒ TemplatePath

Returns a new instance of TemplatePath.



67
68
69
70
# File 'lib/handlebars_assets/tilt_handlebars.rb', line 67

def initialize(scope)
  self.full_path = scope.pathname
  self.template_path = scope.logical_path
end

Instance Method Details

#is_haml?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/handlebars_assets/tilt_handlebars.rb', line 72

def is_haml?
  full_path.to_s.end_with?('.hamlbars')
end

#is_partial?Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/handlebars_assets/tilt_handlebars.rb', line 76

def is_partial?
  template_path.gsub(%r{.*/}, '').start_with?('_')
end

#nameObject



80
81
82
# File 'lib/handlebars_assets/tilt_handlebars.rb', line 80

def name
  is_partial? ? partial_name : template_name
end