Class: CPuts::Functions::Decorators
- Inherits:
-
Object
- Object
- CPuts::Functions::Decorators
- Defined in:
- lib/cputs/functions.rb
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#preffix ⇒ Object
7 8 9 10 |
# File 'lib/cputs/functions.rb', line 7 def preffix @preffix ||= Decorators.default_preffix "#{"#{formatted_time} " if formatted_time}#{@preffix}" end |
#suffix ⇒ Object
12 13 14 |
# File 'lib/cputs/functions.rb', line 12 def suffix @suffix ||= Decorators.default_suffix end |
Class Method Details
.default_preffix ⇒ Object
16 17 18 |
# File 'lib/cputs/functions.rb', line 16 def self.default_preffix "----------------->" end |
.default_suffix ⇒ Object
20 21 22 |
# File 'lib/cputs/functions.rb', line 20 def self.default_suffix '' end |
.default_time_format ⇒ Object
24 25 26 |
# File 'lib/cputs/functions.rb', line 24 def self.default_time_format '%Y-%m-%dT%H:%M:%S' end |
Instance Method Details
#add_time_to_preffix(format = nil) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# 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 |