Class: Britebox::EventLog
- Inherits:
-
Object
- Object
- Britebox::EventLog
- Includes:
- Singleton
- Defined in:
- lib/britebox/event_log.rb
Instance Attribute Summary collapse
-
#log_lines ⇒ Object
Returns the value of attribute log_lines.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ EventLog
constructor
A new instance of EventLog.
Constructor Details
#initialize ⇒ EventLog
Returns a new instance of EventLog.
9 10 11 |
# File 'lib/britebox/event_log.rb', line 9 def initialize @log_lines = [] end |
Instance Attribute Details
#log_lines ⇒ Object
Returns the value of attribute log_lines.
7 8 9 |
# File 'lib/britebox/event_log.rb', line 7 def log_lines @log_lines end |
Class Method Details
.empty? ⇒ Boolean
13 14 15 |
# File 'lib/britebox/event_log.rb', line 13 def self.empty? self.instance.log_lines.empty? end |
.pop ⇒ Object
27 28 29 |
# File 'lib/britebox/event_log.rb', line 27 def self.pop self.instance.log_lines.pop end |
.push(event_type, message) ⇒ Object Also known as: add
17 18 19 20 21 22 23 24 25 |
# File 'lib/britebox/event_log.rb', line 17 def self.push(event_type, ) event = OpenStruct.new(type: event_type, message: , time: Time.now) self.instance.log_lines.push(event) # if Britebox::Config.log ... # save event to log true end |