Class: Clack::Warning

Inherits:
Data
  • Object
show all
Defined in:
lib/clack.rb

Overview

Warning result from validation - allows user to proceed with confirmation. Validators can return a Warning to show a yellow message that doesn’t block submission if the user confirms by pressing Enter again.

Examples:

Validator returning a warning

validate: ->(v) { Clack::Warning.new("File exists, overwrite?") if File.exist?(v) }

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



71
72
73
# File 'lib/clack.rb', line 71

def message
  @message
end

Instance Method Details

#to_sString

Returns the warning message.

Returns:

  • (String)

    the warning message



73
# File 'lib/clack.rb', line 73

def to_s = message