Class: TinyQ::Journal
- Inherits:
-
Object
- Object
- TinyQ::Journal
- Includes:
- Singleton
- Defined in:
- lib/tinyq/journal.rb
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Returns the value of attribute enabled.
Instance Method Summary collapse
- #event(event) ⇒ Object
-
#initialize ⇒ Journal
constructor
A new instance of Journal.
Constructor Details
#initialize ⇒ Journal
Returns a new instance of Journal.
7 8 9 10 |
# File 'lib/tinyq/journal.rb', line 7 def initialize @journal = File.open("journal.txt", "a") @enabled = false end |
Instance Attribute Details
#enabled ⇒ Object
Returns the value of attribute enabled.
5 6 7 |
# File 'lib/tinyq/journal.rb', line 5 def enabled @enabled end |
Instance Method Details
#event(event) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/tinyq/journal.rb', line 12 def event(event) if @enabled now=Time.now.iso8601 @journal.puts("#{now},#{event[:Event]}") @journal.fsync end end |