Class: Yattho::Alpha::Image
- Defined in:
- app/components/yattho/alpha/image.rb
Overview
Use ‘Image` to render images.
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(src:, alt:, lazy: false, **system_arguments) ⇒ Image
constructor
A new instance of Image.
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(src:, alt:, lazy: false, **system_arguments) ⇒ Image
Returns a new instance of Image.
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/components/yattho/alpha/image.rb', line 32 def initialize(src:, alt:, lazy: false, **system_arguments) @system_arguments = deny_tag_argument(**system_arguments) @src = src @system_arguments[:tag] = :img @system_arguments[:alt] = alt return unless lazy @system_arguments[:loading] = :lazy @system_arguments[:decoding] = :async end |
Instance Method Details
#call ⇒ Object
45 46 47 |
# File 'app/components/yattho/alpha/image.rb', line 45 def call render(Yattho::BaseComponent.new(src: image_path(@src), **@system_arguments)) end |