class CPuts::Functions::Decorators
Attributes
preffix[W]
suffix[W]
Public Class Methods
default_preffix()
click to toggle source
# File lib/cputs/functions.rb, line 16 def self.default_preffix "----------------->" end
default_suffix()
click to toggle source
# File lib/cputs/functions.rb, line 20 def self.default_suffix '' end
default_time_format()
click to toggle source
# File lib/cputs/functions.rb, line 24 def self.default_time_format '%Y-%m-%dT%H:%M:%S' end
Public Instance Methods
add_time_to_preffix(format=nil)
click to toggle source
# File lib/cputs/functions.rb, line 28 def add_time_to_preffix(format=nil) begin @format = format return unless @format Time.now.strftime(@format) raise Exception.new('') if @format == '' rescue Exception => ex @format = Decorators.default_time_format print "Warning: Format #{format} is wrong. Please refer to http://apidock.com/ruby/DateTime/strftime" end end
preffix()
click to toggle source
# File lib/cputs/functions.rb, line 7 def preffix @preffix ||= Decorators.default_preffix "#{"#{formatted_time} " if formatted_time}#{@preffix}" end
suffix()
click to toggle source
# File lib/cputs/functions.rb, line 12 def suffix @suffix ||= Decorators.default_suffix end
Private Instance Methods
formatted_time()
click to toggle source
# File lib/cputs/functions.rb, line 41 def formatted_time Time.now.strftime(@format) if @format end