Class: EaseEngine::Log::RotateFile

Inherits:
IO
  • Object
show all
Defined in:
lib/ease_engine/log.rb

Direct Known Subclasses

DailyRotateFile

Instance Attribute Summary collapse

Attributes inherited from IO

#file, #flags

Instance Method Summary collapse

Methods inherited from IO

#close, #write

Constructor Details

#initialize(file, flags = FLAG_ALL, max_size = 1024 * 1024) ⇒ RotateFile

Returns a new instance of RotateFile.



33
34
35
36
37
# File 'lib/ease_engine/log.rb', line 33

def initialize( file, flags = FLAG_ALL, max_size = 1024 * 1024 )
  super( file, flags )
  
  @max_size = max_size
end

Instance Attribute Details

#max_sizeObject

Returns the value of attribute max_size.



31
32
33
# File 'lib/ease_engine/log.rb', line 31

def max_size
  @max_size
end

Instance Method Details

#rotate(file_path) ⇒ Object



39
40
41
42
43
# File 'lib/ease_engine/log.rb', line 39

def rotate( file_path )
  @file.rewind
  FileUtils.copy_stream( @file, file_path )
  @file.truncate( 0 )
end