Class: ViewComponent::Template::File
- Inherits:
-
ViewComponent::Template
- Object
- ViewComponent::Template
- ViewComponent::Template::File
- Defined in:
- lib/view_component/template.rb
Instance Attribute Summary
Attributes inherited from ViewComponent::Template
Instance Method Summary collapse
-
#initialize(component:, details:, path:) ⇒ File
constructor
A new instance of File.
-
#source ⇒ Object
Load file each time we look up #source in case the file has been modified.
- #type ⇒ Object
Methods inherited from ViewComponent::Template
#call_method_name, #compile_to_component, #default_format?, #inline_call?, #normalized_variant_name, #requires_compiled_superclass?, #safe_method_name, #safe_method_name_call
Constructor Details
#initialize(component:, details:, path:) ⇒ File
Returns a new instance of File.
23 24 25 26 27 28 29 30 |
# File 'lib/view_component/template.rb', line 23 def initialize(component:, details:, path:) super( component: component, details: details, path: path, lineno: 0 ) end |
Instance Method Details
#source ⇒ Object
Load file each time we look up #source in case the file has been modified
37 38 39 |
# File 'lib/view_component/template.rb', line 37 def source ::File.read(@path) end |
#type ⇒ Object
32 33 34 |
# File 'lib/view_component/template.rb', line 32 def type :file end |