Class: Daisy::Mockup::CodeLineComponent
- Inherits:
-
LocoMotion::BaseComponent
- Object
- ViewComponent::Base
- LocoMotion::BaseComponent
- Daisy::Mockup::CodeLineComponent
- Defined in:
- app/components/daisy/mockup/code_component.rb
Overview
A component for rendering individual lines within a code block.
Constant Summary
Constants inherited from LocoMotion::BaseComponent
LocoMotion::BaseComponent::EMPTY_PART_IGNORED_TAGS, LocoMotion::BaseComponent::SELF_CLOSING_TAGS
Instance Attribute Summary
Attributes inherited from LocoMotion::BaseComponent
Instance Method Summary collapse
-
#before_render ⇒ Object
Sets up the component’s HTML tags and attributes.
-
#call ⇒ Object
Renders the line with its code content.
-
#initialize(**kws) ⇒ CodeLineComponent
constructor
Creates a new code line.
Methods inherited from LocoMotion::BaseComponent
build, #component_ref, #config_option, #cssify, define_modifier, define_modifiers, define_part, define_parts, define_size, define_sizes, #empty_part_content, #inspect, #part, register_component_initializer, register_component_setup, #rendered_css, #rendered_data, #rendered_html, #rendered_stimulus_controllers, #rendered_tag_name, renders_many, renders_one, set_component_name, #set_loco_parent, #strip_spaces
Constructor Details
#initialize(**kws) ⇒ CodeLineComponent
Creates a new code line.
64 65 66 67 68 |
# File 'app/components/daisy/mockup/code_component.rb', line 64 def initialize(**kws) super(**kws) @prefix = config_option(:prefix) end |
Instance Method Details
#before_render ⇒ Object
Sets up the component’s HTML tags and attributes.
73 74 75 76 77 78 |
# File 'app/components/daisy/mockup/code_component.rb', line 73 def before_render set_tag_name(:component, :pre) set_tag_name(:code, :code) add_html(:component, { "data-prefix": @prefix }) if @prefix end |
#call ⇒ Object
Renders the line with its code content.
83 84 85 86 87 88 89 |
# File 'app/components/daisy/mockup/code_component.rb', line 83 def call part(:component) do part(:code) do content end end end |