Class: TinyQ::Journal

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/tinyq/journal.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeJournal

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

#enabledObject

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