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
- #has_tasks? ⇒ Boolean
-
#initialize(type, tasks) ⇒ LogGroup
constructor
A new instance of LogGroup.
- #to_soml ⇒ Object
- #write(path) ⇒ Object
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
#tasks ⇒ Object (readonly)
Returns the value of attribute tasks.
3 4 5 |
# File 'lib/enparallel/log_group.rb', line 3 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
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
14 15 16 |
# File 'lib/enparallel/log_group.rb', line 14 def has_tasks? tasks.length > 0 end |
#to_soml ⇒ Object
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 |