Class: ViewComponent::Template::Inline

Inherits:
ViewComponent::Template show all
Defined in:
lib/view_component/template.rb

Instance Attribute Summary collapse

Attributes inherited from ViewComponent::Template

#details, #path

Instance Method Summary collapse

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:, inline_template:) ⇒ Inline

Returns a new instance of Inline.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/view_component/template.rb', line 45

def initialize(component:, inline_template:)
  details = ActionView::TemplateDetails.new(nil, inline_template.language.to_sym, nil, nil)

  super(
    component: component,
    details: details,
    path: inline_template.path,
    lineno: inline_template.lineno,
  )

  @source = inline_template.source.dup
end

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



43
44
45
# File 'lib/view_component/template.rb', line 43

def source
  @source
end

Instance Method Details

#typeObject



58
59
60
# File 'lib/view_component/template.rb', line 58

def type
  :inline
end