Sha256: 0fba7e0a73fc1e2f07d17c665565b6b29b313bc8e66054b227c042ac3bbe8425

Contents?: true

Size: 436 Bytes

Versions: 2

Compression:

Stored size: 436 Bytes

Contents

# frozen_string_literal: true

class Scarpe
  class EditLine < Scarpe::Widget
    display_properties :text, :width

    def initialize(text = "", width: nil, &block)
      @block = block
      @text = text

      super

      bind_self_event("change") do |new_text|
        self.text = new_text
        @block&.call(new_text)
      end

      create_display_widget
    end

    def change(&block)
      @block = block
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scarpe-0.2.1 lib/scarpe/edit_line.rb
scarpe-0.2.0 lib/scarpe/edit_line.rb