Module: CPuts

Defined in:
lib/cputs.rb,
lib/cputs/override.rb,
lib/cputs/functions.rb

Overview

This module represents the bridge between CPuts functionality and the user

Defined Under Namespace

Modules: Functions, Override

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.override_putsObject

Override the usual puts method to always use cputs instead.



20
21
22
# File 'lib/cputs.rb', line 20

def CPuts.override_puts
    require_relative 'cputs/override.rb'
end

.set_preffix(preffix) ⇒ Object

Sets the preffix for the output



27
28
29
# File 'lib/cputs.rb', line 27

def CPuts.set_preffix(preffix)
    CPuts::Functions.preffix preffix
end

.set_preffix_and_suffix(*args) ⇒ Object

Sets both the preffix and suffix for the output



41
42
43
# File 'lib/cputs.rb', line 41

def CPuts.set_preffix_and_suffix(*args)
    CPuts::Functions.preffix_and_suffix *args
end

.set_suffix(suffix) ⇒ Object

Sets the suffix for the output



34
35
36
# File 'lib/cputs.rb', line 34

def CPuts.set_suffix(suffix)
    CPuts::Functions.suffix suffix
end

.set_timestamp(format = nil) ⇒ Object

Sets timestamp to be shown in the output. It can be: False to disable it True to enable it String with format, which also enables it



51
52
53
# File 'lib/cputs.rb', line 51

def CPuts.set_timestamp(format=nil)
    CPuts::Functions.timestamp(format)
end

Instance Method Details

#cputs(message) ⇒ Object

The main method to print (puts) a message with the preffix (if set) File (that’s making the call) Line (of the file) and Suffix (if set) :args: message



12
13
14
# File 'lib/cputs.rb', line 12

def cputs(message)
    CPuts::Functions.cputs(message, caller)
end