Class: Enparallel::LogGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/enparallel/log_group.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, tasks) ⇒ LogGroup

Returns a new instance of LogGroup.



5
6
7
8
# File 'lib/enparallel/log_group.rb', line 5

def initialize(type, tasks)
    @type = type
    @tasks = tasks
end

Instance Attribute Details

#tasksObject (readonly)

Returns the value of attribute tasks.



3
4
5
# File 'lib/enparallel/log_group.rb', line 3

def tasks
  @tasks
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/enparallel/log_group.rb', line 3

def type
  @type
end

Class Method Details

.failure(pool) ⇒ Object



31
32
33
# File 'lib/enparallel/log_group.rb', line 31

def self.failure(pool)
    of(:failure, pool)
end

.of(type, pool) ⇒ Object



23
24
25
# File 'lib/enparallel/log_group.rb', line 23

def self.of(type, pool)
    LogGroup.new(type, pool.tasks_of(type))
end

.success(pool) ⇒ Object



27
28
29
# File 'lib/enparallel/log_group.rb', line 27

def self.success(pool)
    of(:success, pool)
end

Instance Method Details

#has_tasks?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/enparallel/log_group.rb', line 14

def has_tasks?
    tasks.length > 0
end

#to_somlObject



10
11
12
# File 'lib/enparallel/log_group.rb', line 10

def to_soml
    tasks.join("\n\n") + "\n"
end

#write(path) ⇒ Object



18
19
20
21
# File 'lib/enparallel/log_group.rb', line 18

def write(path)
    size = File.write(path, to_soml)
    [path, Util.bytes_to_human(size)]
end