module CPuts::Functions
Public Class Methods
cputs(message, caller)
click to toggle source
# File lib/cputs/functions.rb, line 46 def self.cputs(message, caller) matcher = caller.first.match(/^(.*)\:(\d+)/) file, line = matcher.captures[0..1] unless matcher.nil? default_puts "#{decorator.preffix}#{file} at line #{line}: #{message}#{decorator.suffix}" end
decorator()
click to toggle source
# File lib/cputs/functions.rb, line 75 def self.decorator @decorator ||= Decorators.new end
preffix(preffix)
click to toggle source
# File lib/cputs/functions.rb, line 52 def self.preffix(preffix) decorator.preffix = preffix end
preffix_and_suffix(*args)
click to toggle source
# File lib/cputs/functions.rb, line 60 def self.preffix_and_suffix(*args) case args.length when 1 decorator.preffix = args[0] decorator.suffix = args[0] when 2 decorator.preffix = args[0] decorator.suffix = args[1] end end
suffix(suffix)
click to toggle source
# File lib/cputs/functions.rb, line 56 def self.suffix(suffix) decorator.suffix = suffix end
timestamp(format)
click to toggle source
# File lib/cputs/functions.rb, line 71 def self.timestamp(format) decorator.add_time_to_preffix(format) end