Class: Yattho::Beta::Truncate::TruncateText
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Yattho::Beta::Truncate::TruncateText
- Defined in:
- app/components/yattho/beta/truncate.rb
Overview
This component is part of ‘Yattho::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
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
Constructor Details
#initialize(priority: false, expandable: false, max_width: nil, **system_arguments) ⇒ TruncateText
Returns a new instance of TruncateText.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'app/components/yattho/beta/truncate.rb', line 90 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': ) return if max_width.nil? @system_arguments[:style] = join_style_arguments(@system_arguments[:style], "max-width: #{max_width}px;") end |
Instance Method Details
#call ⇒ Object
106 107 108 109 110 |
# File 'app/components/yattho/beta/truncate.rb', line 106 def call render(Yattho::BaseComponent.new(**@system_arguments)) do content end end |