Class: Yattho::Beta::Truncate
- Defined in:
- app/components/yattho/beta/truncate.rb
Overview
Use ‘Truncate` to shorten overflowing text with an ellipsis.
Defined Under Namespace
Classes: TruncateText
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
Instance Method Summary collapse
- #before_render ⇒ Object
-
#initialize(**system_arguments) ⇒ Truncate
constructor
A new instance of Truncate.
- #render? ⇒ Boolean
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
Constructor Details
#initialize(**system_arguments) ⇒ Truncate
Returns a new instance of Truncate.
68 69 70 71 72 73 74 75 |
# File 'app/components/yattho/beta/truncate.rb', line 68 def initialize(**system_arguments) @system_arguments = system_arguments @system_arguments[:tag] = system_arguments[:tag] || :span @system_arguments[:classes] = class_names( "Truncate", system_arguments[:classes] ) end |
Instance Method Details
#before_render ⇒ Object
77 78 79 80 81 |
# File 'app/components/yattho/beta/truncate.rb', line 77 def before_render return unless content.present? && items.empty? with_item { content } end |
#render? ⇒ Boolean
83 84 85 |
# File 'app/components/yattho/beta/truncate.rb', line 83 def render? items? end |