Class: Yell::Adapters::Datefile

Inherits:
File show all
Defined in:
lib/yell/adapters/datefile.rb

Overview

The Datefile adapter is similar to the File adapter. However, it rotates the file at midnight.

Constant Summary collapse

DefaultDatePattern =

The default date pattern, e.g. “19820114” (14 Jan 1982)

"%Y%m%d"

Constants inherited from Io

Io::Colors

Instance Attribute Summary

Attributes inherited from Io

#format

Attributes inherited from Base

#level, #options

Instance Method Summary collapse

Methods inherited from File

#stream

Methods inherited from Io

#colorize, #stream

Methods inherited from Base

#write

Constructor Details

#initialize(options = {}, &block) ⇒ Datefile

Returns a new instance of Datefile.



13
14
15
16
17
18
19
20
21
22
# File 'lib/yell/adapters/datefile.rb', line 13

def initialize( options = {}, &block )
  @date_pattern = options[:date_pattern] || DefaultDatePattern

  @file_basename = options[:filename] || default_filename
  options[:filename] = @file_basename

  @date = nil # default; do not override --R

  super
end

Instance Method Details

#Reset(thefilehandle) ⇒ Object



25
26
27
28
29
# File 'lib/yell/adapters/datefile.rb', line 25

def close
  @filename = new_filename

  super
end