Sha256: 8737f4938e6345ef7bbdf86d97f460effaf0ebb5f67b581abbe6c9d80c4c3801
Contents?: true
Size: 749 Bytes
Versions: 3
Compression:
Stored size: 749 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",'')) if text.include?("\n") result = @text_field.value result = result.to_i if @options[:type] == :integer @submit.call(result) end end def cursor Cursor.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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruco-0.0.8 | lib/ruco/form.rb |
ruco-0.0.7 | lib/ruco/form.rb |
ruco-0.0.6 | lib/ruco/form.rb |