class Term::Prompt::EnumList

Defined in:

prompt/enum_list.cr

Constant Summary

PAGE_HELP = "(Press tab/right or left to reveal more choices)"

Constructors

Instance Method Summary

Constructor Detail

def self.new(prompt : Term::Prompt, **options) #

Create instance of EnumList menu.


[View source]

Instance Method Detail

def answer #

Find value for the choice selected


[View source]
def call(question : Nil | String, possibilities, &block : EnumList -> ) #

Call the list menu by passing question and choices


[View source]
def call(question, possibilities) #

ditto


[View source]
def choice(*value, &block) #

Add a single choice


[View source]
def choices : Choices #

[View source]
def choices=(values) #

Add multiple choices


[View source]
def default : Int32 #

[View source]
def default=(default : Int32) #

[View source]
def default? #

Check if default value is set


[View source]
def done : Bool #

[View source]
def error_message #

Error message when incorrect index chosen


[View source]
def failure : Bool #

[View source]
def input : String | Nil #

[View source]
def keyenter #

[View source]
def keyleft #

[View source]
def keypress(key, event) #

[View source]
def keyreturn #

[View source]
def keyright #

[View source]
def mark_choice_as_active #

Find active choice or set to default


[View source]
def page_help : String #

[View source]
def page_help=(page_help : String) #

[View source]
def page_help_message #

Pagination help message


[View source]
def page_size : Int32 #

[View source]
def page_size=(page_size : Int32) #

[View source]
def paginated? #

Check if list is paginated


[View source]
def prefix : String #

[View source]
def prefix=(prefix : String) #

[View source]
def question_lines_count(question_lines) #

Count how many screen lines the question spans


[View source]
def refresh(lines) #

Determine area of the screen to clear


[View source]
def render #

Render a selection list.


[View source]
def render_error #

Render error message and return cursor to position of input


[View source]
def render_footer #

Render footer for the indexed menu


[View source]
def render_header #

Render chosen option


[View source]
def render_menu #

Render menu with indexed choices to select from


[View source]
def render_page_help #

Render page help


[View source]
def render_question #

Render question with the menu options


[View source]
def separator : String #

[View source]
def separator=(separator : String) #

[View source]
def setup_defaults #

Setup default option and active selection


[View source]
def symbols : Hash(Symbol, String) #

[View source]
def symbols=(new_symbols) #

Change symbols used by this prompt


[View source]
def validate_defaults #

Validate default indexes to be within range


[View source]