Sha256: 78620be73c7e602f48c5ee7a501b98c2612960b53dfb099820d6171455722f2c
Contents?: true
Size: 806 Bytes
Versions: 5
Compression:
Stored size: 806 Bytes
Contents
module Ruco class Form delegate :move, :delete, :value, :selecting, :selection, :text_in_selection, :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 style_map map = @text_field.style_map map.left_pad!(@label.size) map 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
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
ruco-0.0.55 | lib/ruco/form.rb |
ruco-0.0.54 | lib/ruco/form.rb |
ruco-0.0.53 | lib/ruco/form.rb |
ruco-0.0.52 | lib/ruco/form.rb |
ruco-0.0.51 | lib/ruco/form.rb |