Class: Peephole::Logfile
- Inherits:
-
Object
- Object
- Peephole::Logfile
- Defined in:
- app/models/peephole/logfile.rb
Constant Summary collapse
- LOG_PATH =
Rails.root.join('log')
Instance Attribute Summary collapse
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #bytes(page) ⇒ Object
-
#initialize(path) ⇒ Logfile
constructor
A new instance of Logfile.
- #lines(page) ⇒ Object
- #size ⇒ Object
- #to_param ⇒ Object
- #updated_at ⇒ Object
Constructor Details
#initialize(path) ⇒ Logfile
Returns a new instance of Logfile.
27 28 29 30 |
# File 'app/models/peephole/logfile.rb', line 27 def initialize(path) self.path = path self.filename = File.basename(path) end |
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
3 4 5 |
# File 'app/models/peephole/logfile.rb', line 3 def filename @filename end |
#path ⇒ Object
Returns the value of attribute path.
3 4 5 |
# File 'app/models/peephole/logfile.rb', line 3 def path @path end |
Class Method Details
Instance Method Details
#bytes(page) ⇒ Object
40 41 42 |
# File 'app/models/peephole/logfile.rb', line 40 def bytes(page) Logline.bytes(path, page) end |
#lines(page) ⇒ Object
36 37 38 |
# File 'app/models/peephole/logfile.rb', line 36 def lines(page) Logline.lines(path, page) end |
#size ⇒ Object
44 45 46 |
# File 'app/models/peephole/logfile.rb', line 44 def size (File.size(path) / 1024.0).ceil end |
#to_param ⇒ Object
32 33 34 |
# File 'app/models/peephole/logfile.rb', line 32 def to_param filename end |
#updated_at ⇒ Object
48 49 50 |
# File 'app/models/peephole/logfile.rb', line 48 def updated_at File.mtime(path) end |