Sha256: 3e66c93337c7f5b76687cdbb75221c7f73098f3eeeecb7d80b6f8ca61f221614
Contents?: true
Size: 780 Bytes
Versions: 1
Compression:
Stored size: 780 Bytes
Contents
require "putsplus/version" module Putsplus # puts only if obj is not nil # # Arguments: # obj: the obj that will be puts if it isn't nil # prefix: obj to append to the puts if obj isn't nil def nputs obj, prefix = nil puts prefix.to_s + obj.to_s unless obj.nil? end def tputs *obj out = "" obj.each_with_index do |o, index| s = o.to_s s += "\t" unless index == obj.size - 1 out << s end puts out end def linebr num = 6, char = '-' raise Exeception, "num must be an Integer" unless is_int?(num) raise Exeception, "char must be an Character or String" unless (is_string? char) puts char * num end private def is_int? obj true if Integer(obj) rescue false end def is_string? obj true if String(obj) rescue false end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
putsplus-0.0.2 | lib/putsplus.rb |