struct Term::Prompt::Choice

Defined in:

prompt/choice.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(name : String, value : -> String | String | Nil = nil, key : Nil | String = nil, disabled : Nil | String = nil) #

Create a Choice instance


[View source]

Class Method Detail

def self.from(val) #

Create choice from value

Example:

Choice.from(:foo)
# => <Term::Prompt::Choice @key=nil @name="foo" @value="foo" @disabled=false>

Choice.from({name: :foo, value: 1, key: 'f'}
# => <Term::Prompt::Choice @key="f" @name="foo" @value=1 @disabled=false>

[View source]

Instance Method Detail

def ==(other) #

Object equality comparison


[View source]
def disabled : String | Nil #

The text to display for disabled choice


[View source]
def disabled? #

[View source]
def key : String | Nil #

The keyboard key to activate this choice


[View source]
def name : String #

The label name


[View source]
def to_s #

Object string representation


[View source]
def value #

Read value and evaluate


[View source]