Sha256: 489b9a1468f9576b1e832629b32da218f9b915e285d3c96cae360051b90ada9f
Contents?: true
Size: 558 Bytes
Versions: 2
Compression:
Stored size: 558 Bytes
Contents
# frozen_string_literal: true class Scarpe class Link < Scarpe::TextWidget display_properties :text, :click, :has_block def initialize(text, click: nil, &block) @text = text @block = block # We can't send a block to the display widget, but we can send a boolean @has_block = !block.nil? super # The click property should be changed before it gets sent to the display widget @click ||= "#" bind_self_event("click") do @block&.call end create_display_widget end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
scarpe-0.2.1 | lib/scarpe/link.rb |
scarpe-0.2.0 | lib/scarpe/link.rb |