Sha256: fc120e57254e8dc23c9b2e27b33489234f4c9dcd35c4f661ca31309c2b932048
Contents?: true
Size: 871 Bytes
Versions: 39
Compression:
Stored size: 871 Bytes
Contents
module Generators module HoboSupport module ThorShell PREFIX = ' => ' private def ask(statement, default='', color=:magenta) result = super(statement, color) result = default if result.blank? say PREFIX + result.inspect result end def yes_no?(statement, color=:magenta) result = choose(statement + ' [y|n]', /^(y|n)$/i) result == 'y' ? true : false end def choose(prompt, format, default=nil) choice = ask prompt, default case when choice =~ format choice when choice.blank? && !default.blank? default else say 'Unknown choice! ', :red choose(prompt, format, default) end end def say_title(title) say "\n #{title} \n", "\e[37;44m" end end end end
Version data entries
39 entries across 39 versions & 1 rubygems