Class: Primer::Forms::Caption
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- Primer::Forms::Caption
- Defined in:
- app/lib/primer/forms/caption.rb
Overview
:nodoc:
Instance Method Summary collapse
- #before_render ⇒ Object
- #caption_template? ⇒ Boolean
-
#initialize(input:) ⇒ Caption
constructor
A new instance of Caption.
- #render_caption_template ⇒ Object
Methods inherited from BaseComponent
#content, inherited, #input?, #perform_render, #render?, #to_component, #type
Methods included from ActsAsComponent
#base_template_path, #compile!, extended, #renders_templates, #template_root_path
Methods included from ClassNameHelper
Constructor Details
permalink #initialize(input:) ⇒ Caption
Returns a new instance of Caption.
7 8 9 |
# File 'app/lib/primer/forms/caption.rb', line 7 def initialize(input:) @input = input end |
Instance Method Details
permalink #before_render ⇒ Object
[View source]
19 20 21 22 23 24 25 26 |
# File 'app/lib/primer/forms/caption.rb', line 19 def before_render return unless @input.caption? && caption_template? raise <<~MESSAGE Please provide either a caption: argument or caption template for the '#{@input.name}' input; both were found. MESSAGE end |
permalink #caption_template? ⇒ Boolean
11 12 13 |
# File 'app/lib/primer/forms/caption.rb', line 11 def caption_template? @input.caption_template? end |
permalink #render_caption_template ⇒ Object
[View source]
15 16 17 |
# File 'app/lib/primer/forms/caption.rb', line 15 def render_caption_template @input.render_caption_template end |