Sha256: 1e9cf974347c0209ef743ba781baaeda824fdce933a0f2ab3eb0af1f83dae9a5
Contents?: true
Size: 620 Bytes
Versions: 30
Compression:
Stored size: 620 Bytes
Contents
# frozen_string_literal: true # Behaviors allow you to add specific code to any particle, enabling the particle to behave differently. # Here, when the first box receives a value, it behaves differently from the second box even if they received # the same params . text({ data: :hello, id: :the_txt, left: 120 }) b=box my_lambda= lambda do |new_value| grab(:the_txt).color(:red) end b.behavior({value: my_lambda}) my_second_lambda= lambda do |new_value| grab(:the_txt).data('from cirle') end c=box({top: 69}) c.behavior({value: my_second_lambda}) wait 1 do c.value(:ok) end wait 2 do b.value(:ok) end
Version data entries
30 entries across 30 versions & 1 rubygems