Class: TTY2::Prompt::Question::Checks::CheckRequired

Inherits:
Object
  • Object
show all
Defined in:
lib/tty2/prompt/question/checks.rb

Overview

Check if input is required

Class Method Summary collapse

Class Method Details

.call(question, value) ⇒ Object



78
79
80
81
82
83
84
# File 'lib/tty2/prompt/question/checks.rb', line 78

def self.call(question, value)
  if question.required? && !question.default? && value.nil?
    [value, question.message_for(:required?)]
  else
    [value]
  end
end