Class: Primer::Beta::Truncate::TruncateText
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Primer::Beta::Truncate::TruncateText
- Defined in:
- app/components/primer/beta/truncate.rb
Overview
This component is part of ‘Primer::Beta::Truncate` and should not be used as a standalone component.
Constant Summary
Constants inherited from Component
Component::INVALID_ARIA_LABEL_TAGS
Constants included from Status::Dsl
Constants included from ViewHelper
Constants included from TestSelectorHelper
TestSelectorHelper::TEST_SELECTOR_TAG
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Constants included from AttributesHelper
AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(priority: false, expandable: false, max_width: nil, **system_arguments) ⇒ TruncateText
constructor
A new instance of TruncateText.
Methods inherited from Component
Methods included from JoinStyleArgumentsHelper
Methods included from TestSelectorHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Methods included from AttributesHelper
#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes
Methods included from ExperimentalSlotHelpers
Methods included from ExperimentalRenderHelpers
Constructor Details
#initialize(priority: false, expandable: false, max_width: nil, **system_arguments) ⇒ TruncateText
Returns a new instance of TruncateText.
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/components/primer/beta/truncate.rb', line 40 def initialize(priority: false, expandable: false, max_width: nil, **system_arguments) @system_arguments = system_arguments @system_arguments[:tag] = system_arguments[:tag] || :span @system_arguments[:classes] = class_names( "Truncate-text", system_arguments[:classes], "Truncate-text--primary": priority, "Truncate-text--expandable": ) @system_arguments[:style] = join_style_arguments(@system_arguments[:style], "max-width: #{max_width}px;") unless max_width.nil? end |
Instance Method Details
#call ⇒ Object
53 54 55 56 57 |
# File 'app/components/primer/beta/truncate.rb', line 53 def call render(Primer::BaseComponent.new(**@system_arguments)) do content end end |