Class: RBatch::Journal

Inherits:
Object
  • Object
show all
Defined in:
lib/rbatch/journal.rb

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Journal) initialize(verbose = nil)

Returns a new instance of Journal



7
8
9
10
11
12
13
14
15
# File 'lib/rbatch/journal.rb', line 7

def initialize(verbose=nil)
  if ! verbose.nil?
    @journal_verbose = verbose
  else
    @journal_verbose = @@def_vars[:rbatch_journal_level]
  end
  @journals = []
  @user_logs = []
end

Instance Attribute Details

- (Object) journal_verbose (readonly)

Returns the value of attribute journal_verbose



6
7
8
# File 'lib/rbatch/journal.rb', line 6

def journal_verbose
  @journal_verbose
end

- (Object) journals (readonly)

Returns the value of attribute journals



6
7
8
# File 'lib/rbatch/journal.rb', line 6

def journals
  @journals
end

- (Object) user_logs (readonly)

Returns the value of attribute user_logs



6
7
8
# File 'lib/rbatch/journal.rb', line 6

def user_logs
  @user_logs
end

Class Method Details

+ (Object) def_vars=(a)



5
# File 'lib/rbatch/journal.rb', line 5

def Journal.def_vars=(a) ; @@def_vars=a ; end

Instance Method Details

- (Object) add_log(log)



28
29
30
31
32
33
34
35
# File 'lib/rbatch/journal.rb', line 28

def add_log(log)
  @user_logs << log
  if @@def_vars[:mix_rbatch_journal_to_logs]
    @journals.each do |j|
      log.journal(j)
    end
  end
end

- (Object) put(level, str)



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rbatch/journal.rb', line 16

def put(level,str)
  if level <= @journal_verbose
    @journals << str
    str = "[RBatch] " + str
    puts str
    @user_logs.each do |log|
      if @@def_vars[:mix_rbatch_journal_to_logs]
        log.journal(str)
      end
    end
  end
end