Class: SorbetView::Compiler::TemplateContext
- Inherits:
-
T::Struct
- Object
- T::Struct
- SorbetView::Compiler::TemplateContext
- Extended by:
- T::Sig
- Defined in:
- lib/sorbet_view/compiler/template_context.rb
Class Method Summary collapse
- .resolve(template_path, config) ⇒ Object
- .resolve_component(component_path, class_name, config) ⇒ Object
Instance Method Summary collapse
Class Method Details
.resolve(template_path, config) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/sorbet_view/compiler/template_context.rb', line 33 def self.resolve(template_path, config) ruby_path = File.join(config.output_dir, "#{template_path}.rb") classification = classify(template_path, config) case classification when :mailer_view resolve_mailer_view(template_path, ruby_path, config) when :layout resolve_layout(template_path, ruby_path, config) when :partial resolve_partial(template_path, ruby_path, config) when :controller_view resolve_controller_view(template_path, ruby_path, config) else resolve_generic(template_path, ruby_path, config) end end |
.resolve_component(component_path, class_name, config) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/sorbet_view/compiler/template_context.rb', line 21 def self.resolve_component(component_path, class_name, config) ruby_path = File.join(config.output_dir, "#{component_path}__erb_template.rb") new( class_name: class_name, superclass: nil, includes: [], template_path: component_path, ruby_path: ruby_path ) end |
Instance Method Details
#superclass_clause ⇒ Object
16 17 18 |
# File 'lib/sorbet_view/compiler/template_context.rb', line 16 def superclass_clause superclass ? " < #{superclass}" : '' end |