Class: Cosmos::IntegerChooserIntValidator
- Defined in:
- lib/cosmos/gui/choosers/integer_chooser.rb
Instance Method Summary collapse
- #fixup(input) ⇒ Object
-
#initialize(*args) ⇒ IntegerChooserIntValidator
constructor
A new instance of IntegerChooserIntValidator.
Constructor Details
#initialize(*args) ⇒ IntegerChooserIntValidator
Returns a new instance of IntegerChooserIntValidator.
17 18 19 |
# File 'lib/cosmos/gui/choosers/integer_chooser.rb', line 17 def initialize(*args) super(*args) end |
Instance Method Details
#fixup(input) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cosmos/gui/choosers/integer_chooser.rb', line 21 def fixup(input) begin value = input.to_i if value < bottom() # Handle less than bottom parent().setText(bottom().to_s) elsif value > top() # Handle greater than top parent().setText(top().to_s) elsif input != value.to_s # Handle poorly formatted (only known case is float given as starting value) parent().setText(value.to_s) end rescue Exception => err # Oh well no fixup end end |