Class: LogAuditor::Reader
- Inherits:
-
Object
- Object
- LogAuditor::Reader
- Defined in:
- lib/log_auditor/reader.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#log_file ⇒ Object
readonly
Returns the value of attribute log_file.
Instance Method Summary collapse
-
#initialize(log_file) ⇒ Reader
constructor
A new instance of Reader.
- #read! ⇒ Object
Constructor Details
#initialize(log_file) ⇒ Reader
Returns a new instance of Reader.
9 10 11 12 |
# File 'lib/log_auditor/reader.rb', line 9 def initialize(log_file) @log_file = log_file @data = [] end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
7 8 9 |
# File 'lib/log_auditor/reader.rb', line 7 def data @data end |
#log_file ⇒ Object (readonly)
Returns the value of attribute log_file.
6 7 8 |
# File 'lib/log_auditor/reader.rb', line 6 def log_file @log_file end |
Instance Method Details
#read! ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/log_auditor/reader.rb', line 14 def read! raise LogAuditor::Errors::NoFileError unless File.exist?(log_file) @data = fetch_content rescue Errno, TypeError raise LogAuditor::Errors::FileReadError end |