Sha256: 9e9b7b22e164223db16f19274473ebfd73ddf708a0b94a06e1fdb5847634e06b
Contents?: true
Size: 1.21 KB
Versions: 9
Compression:
Stored size: 1.21 KB
Contents
module Githug module UI @@out_stream = STDOUT @@in_stream = STDIN class << self def out_stream=(out) @@out_stream = out end def in_stream=(in_stream) @@in_stream = in_stream end def puts(string = "") @@out_stream.puts(string) end def print(string) @@out_stream.print(string) end def gets @@in_stream.gets end def word_box(string,width=80,char='*') puts char*width puts "#{char}#{string.center(width-2)}#{char}" puts char*width end def request(msg) print("#{msg} ") gets.chomp end def ask(msg) request("#{msg} [yn] ") == 'y' end def colorize(text, color_code) return puts text if ENV['OS'] && ENV['OS'].downcase.include?("windows") puts "#{color_code}#{text}\033[0m" end def error(text) colorize(text, "\033[31m") end def success(text) colorize(text, "\033[32m") end end def method_missing(method, *args, &block) return UI.send(method, *args) if UI.methods(false).include?(method.to_s) || UI.methods(false).include?(method) super end end end
Version data entries
9 entries across 9 versions & 1 rubygems