Class: Enparallel::LogGroup
- Inherits:
-
Object
- Object
- Enparallel::LogGroup
- Defined in:
- lib/enparallel/log_group.rb
Instance Attribute Summary collapse
-
#tasks ⇒ Object
readonly
Returns the value of attribute tasks.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type, tasks) ⇒ LogGroup
constructor
A new instance of LogGroup.
- #tasks? ⇒ Boolean
- #to_soml ⇒ Object
- #write(path) ⇒ Object
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
#tasks ⇒ Object (readonly)
Returns the value of attribute tasks.
4 5 6 |
# File 'lib/enparallel/log_group.rb', line 4 def tasks @tasks end |
#type ⇒ Object (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
15 16 17 |
# File 'lib/enparallel/log_group.rb', line 15 def tasks? tasks.length > 0 end |
#to_soml ⇒ Object
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 |