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.



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

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

Instance Attribute Details

#tasksObject (readonly)

Returns the value of attribute tasks.



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

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



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

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

.of(type, pool) ⇒ Object



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

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

.success(pool) ⇒ Object



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

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

Instance Method Details

#tasks?Boolean

Returns:

  • (Boolean)


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

def tasks?
    tasks.length > 0
end

#to_somlObject



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

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

#write(path) ⇒ Object



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

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