Class: Umu::Inputter
- Inherits:
-
Object
- Object
- Umu::Inputter
- Extended by:
- Template
- Defined in:
- lib/umu/core/inputter.rb
Overview
Inputter is a module for inputting.
Constant Summary
Constants included from Color
Class Method Summary collapse
Methods included from Template
checker, command, cover, hover, logo, pointer, show_command
Class Method Details
.input(content, has_vaild = false, check_target = []) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/umu/core/inputter.rb', line 11 def self.input(content, has_vaild = false, check_target = []) puts content.to_s input_val = gets is_empty = input_val.chomp == '' while is_empty cover(2) puts "\e[1A" puts "#{content} #{red(I18n.t('inputter.required'))}" input_val = gets is_empty = input_val.chomp == '' end if has_vaild is_overlap = Umu::Validation.check_overlap(check_target, input_val.chomp) while is_overlap cover(2) puts "\e[1A" puts "#{content} #{red("#{input_val.chomp} #{I18n.t('inputter.is_overlap')}")}" input_val = gets is_empty = input_val.chomp == '' while is_empty cover(2) puts "\e[1A" puts "#{content} #{red(I18n.t('inputter.required'))}" input_val = gets is_empty = input_val.chomp == '' end is_overlap = Umu::Validation.check_overlap(check_target, input_val.chomp) end end puts "\e[2A" input_val.chomp end |