Sha256: 1ed882a8acf3cae270111f0a3a3efd01659e0f3dad5fe34bd973235ddd6ef004
Contents?: true
Size: 1.27 KB
Versions: 5
Compression:
Stored size: 1.27 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 line puts("*"*80) end def word_box(string) space_length = (80/2) - ((string.length/2)+1) line print "*" print " "*space_length print string print " "*space_length puts "*" line end def request(msg) print("#{msg} ") gets.chomp end def ask(msg) request("#{msg} [yn] ") == 'y' end def colorize(text, color_code) 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
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
githug-0.1.8 | lib/githug/ui.rb |
githug-0.1.7 | lib/githug/ui.rb |
githug-0.1.6 | lib/githug/ui.rb |
githug-0.1.5 | lib/githug/ui.rb |
githug-0.1.4 | lib/githug/ui.rb |