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
-
#initialize(path) ⇒ Logfile
constructor
A new instance of Logfile.
- #loglines(page) ⇒ Object
- #to_param ⇒ Object
Constructor Details
#initialize(path) ⇒ Logfile
Returns a new instance of Logfile.
26 27 28 29 |
# File 'app/models/peephole/logfile.rb', line 26 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
.all ⇒ Object
12 13 14 15 16 |
# File 'app/models/peephole/logfile.rb', line 12 def all glob.map do |path| Logfile.new(path) end end |
.find(filename) ⇒ Object
18 19 20 21 22 23 |
# File 'app/models/peephole/logfile.rb', line 18 def find(filename) path = glob.find do |path| File.basename(path) == filename end Logfile.new(path) end |
.glob ⇒ Object
8 9 10 |
# File 'app/models/peephole/logfile.rb', line 8 def glob Dir.glob(LOG_PATH.join("#{Rails.env}.log*")) end |