Sha256: b1bc2df26189fc0a4cbe48025552a55f6d22fc0c7aba8e7556cffbdd81af0d0f
Contents?: true
Size: 649 Bytes
Versions: 2
Compression:
Stored size: 649 Bytes
Contents
module Ruco class Form delegate :move, :delete, :to => :text_field def initialize(label, options, &submit) @options = options @label = label.strip + ' ' @submit = submit reset end def view @label + @text_field.view end def insert(text) @text_field.insert(text.gsub("\n",'')) @submit.call(@text_field.value) if text.include?("\n") end def cursor Position.new 0, @label.size + @text_field.cursor.column end def reset @text_field = TextField.new(:columns => @options[:columns] - @label.size) end private attr_reader :text_field end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruco-0.0.30 | lib/ruco/form.rb |
ruco-0.0.29 | lib/ruco/form.rb |