Sha256: 4f0ed140fb265e4c6c6c493b6006758c473a5bef04f9c45fff30d8661c9d2fe5
Contents?: true
Size: 1013 Bytes
Versions: 14
Compression:
Stored size: 1013 Bytes
Contents
require_relative 'mixins/event' require_relative 'mixins/tooltips' module Voom module Presenters module DSL module Components class Image < EventBase include Mixins::Tooltips attr_accessor :image, :height, :width, :position, :selected, :url def initialize(**attribs_, &block) super(type: :image, context: context, **attribs_, &block) @image = attribs.delete(:image) @height = attribs.delete(:height) @width = attribs.delete(:width) @position = Array(attribs.delete(:position)).compact @selected = attribs.delete(:selected) @url = build_url expand! end private def build_url return nil unless image return image if image.start_with?('/') || @image.start_with?('http') @parent.router.url(render: image, context: {}) end end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems