struct Term::Prompt::Choice
- Term::Prompt::Choice
- Struct
- Value
- Object
Defined in:
prompt/choice.crConstructors
-
.new(name : String, value : -> String | String | Nil = nil, key : Nil | String = nil, disabled : Nil | String = nil)
Create a Choice instance
Class Method Summary
-
.from(val)
Create choice from value
Instance Method Summary
-
#==(other)
Object equality comparison
-
#disabled : String | Nil
The text to display for disabled choice
- #disabled?
-
#key : String | Nil
The keyboard key to activate this choice
-
#name : String
The label name
-
#to_s
Object string representation
-
#value
Read value and evaluate
Constructor Detail
def self.new(name : String, value : -> String | String | Nil = nil, key : Nil | String = nil, disabled : Nil | String = nil)
#
Create a Choice instance
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>