Method: NA.color_single_options

Defined in:
lib/na/next_action.rb

.color_single_options(choices = %w[y n])) ⇒ String

Helper function to colorize the Y/N prompt

Parameters:

  • choices (Array) (defaults to: %w[y n]))

    The choices with default capitalized

Returns:

  • (String)

    colorized string



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/na/next_action.rb', line 56

def color_single_options(choices = %w[y n])
  out = []
  choices.each do |choice|
    case choice
    when /[A-Z]/
      out.push(NA::Color.template("{bw}#{choice}{x}"))
    else
      out.push(NA::Color.template("{dw}#{choice}{xg}"))
    end
  end
  NA::Color.template("{xg}[#{out.join('/')}{xg}]{x}")
end