Module: PbSyringe::Progressable

Defined in:
lib/pb_syringe/progressable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#progress_unitObject

Returns the value of attribute progress_unit.



3
4
5
# File 'lib/pb_syringe/progressable.rb', line 3

def progress_unit
  @progress_unit
end

Instance Method Details

#progress_finishObject



13
14
15
16
# File 'lib/pb_syringe/progressable.rb', line 13

def progress_finish
  return if PbSyringe.suppress?
  progress_unit.finish if progress_unit
end

#progress_increment(count) ⇒ Object



18
19
20
21
# File 'lib/pb_syringe/progressable.rb', line 18

def progress_increment(count)
  return if PbSyringe.suppress?
  progress_unit.increment(count) if progress_unit
end

#progress_start(**options) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/pb_syringe/progressable.rb', line 5

def progress_start(**options)
  return if PbSyringe.suppress?
  progress_unit.start(**options) if progress_unit
  return unless block_given?
  yield
  progress_finish
end