struct

Term::Prompt::Choice

Inherits Struct / Value / Object

Constructors

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

Create a Choice instance

Source

Class methods

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>
Source

Instance methods

==(other)

Object equality comparison

Source
disabled

The text to display for disabled choice

Source
disabled?
Source
key

The keyboard key to activate this choice

Source
name

The label name

Source
to_s

Object string representation

Source
value

Read value and evaluate

Source