Module: ProgressBar::Depreciable

Included in:
Base
Defined in:
lib/progress_bar/depreciable.rb

Constant Summary collapse

DEPRECATION_DATE =
"June 30th, 2013"

Instance Method Summary collapse

Instance Method Details

#backwards_compatible_args_to_options_conversion(args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/progress_bar/depreciable.rb', line 5

def backwards_compatible_args_to_options_conversion(args)
  options = {}

  if args.size > 1
    puts "DEPRECATION WARNING: Creating progress bars using ProgressBar.new(title, total, output_io) has been deprecated and will be removed on or after #{DEPRECATION_DATE}.  Please use ProgressBar.create(:title => title, :total => total, :output => output_io) instead. The full list of options can be found here: https://github.com/jfelchner/ruby-progressbar."
    options[:title]  = args[0]
    options[:total]  = args[1]
    options[:output] = args[2]
  else
    options = args[0]
  end

  options
end

#bar_mark=(mark) ⇒ Object



44
45
46
47
48
# File 'lib/progress_bar/depreciable.rb', line 44

def bar_mark=(mark)
  method_deprecation_message 'bar_mark=', 'progress_mark='

  progress_mark = mark
end

#currentObject



76
77
78
79
80
# File 'lib/progress_bar/depreciable.rb', line 76

def current
  method_deprecation_message 'current', 'progress'

  @bar.progress
end

#file_transfer_modeObject



90
91
92
# File 'lib/progress_bar/depreciable.rb', line 90

def file_transfer_mode
  method_removal_message 'file_transfer_mode', 'We will be implementing a much better file transfer progress bar in the upcoming version however it has been removed for v1.0.  If you still require this functionality, you should remain at v0.11.0'
end

#format=(value) ⇒ Object



68
69
70
# File 'lib/progress_bar/depreciable.rb', line 68

def format=(value)
  method_removal_message 'format=', 'The formatter has been completely rewriten for v1.0.  Please use `#format(format_string)`.  See https://github.com/jfelchner/ruby-progressbar for all the formatting options.'
end

#format_arguments=(value) ⇒ Object



72
73
74
# File 'lib/progress_bar/depreciable.rb', line 72

def format_arguments=(value)
  method_removal_message 'format_arguments=', 'The formatter has been completely rewriten for v1.0.  Please use `#format(format_string)`.  See https://github.com/jfelchner/ruby-progressbar for all the formatting options.'
end

#haltObject



38
39
40
41
42
# File 'lib/progress_bar/depreciable.rb', line 38

def halt
  method_deprecation_message 'halt', 'stop'

  stop
end

#inc(value = nil) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/progress_bar/depreciable.rb', line 20

def inc(value = nil)
  if value.nil?
    method_deprecation_message 'inc', 'increment'

    increment
  else
    method_removal_message 'inc', 'Rather than passing a step increment to the new #increment method, you can simply do `my_progress_bar.progress += step`.'

    progress = progress + value.to_i
  end
end

#set(new_value) ⇒ Object



32
33
34
35
36
# File 'lib/progress_bar/depreciable.rb', line 32

def set(new_value)
  method_deprecation_message 'set', 'progress='

  progress = new_value
end

#smoothingObject



82
83
84
# File 'lib/progress_bar/depreciable.rb', line 82

def smoothing
  method_removal_message 'smoothing'
end

#smoothing=(value) ⇒ Object



86
87
88
# File 'lib/progress_bar/depreciable.rb', line 86

def smoothing=(value)
  method_removal_message 'smoothing=', 'This value can only be set via the options hash when creating a new progress bar like so: ProgressBar.create(:smoothing => 0.2)'
end

#start_timeObject



58
59
60
61
62
# File 'lib/progress_bar/depreciable.rb', line 58

def start_time
  method_deprecation_message 'start_time'

  @elapsed_time.instance_variable_get(:@started_at)
end

#start_time=(value) ⇒ Object



64
65
66
# File 'lib/progress_bar/depreciable.rb', line 64

def start_time=(value)
  method_removal_message 'start_time=', 'It is no longer appropriate to set the start time of the bar. Using #start, #stop, #pause and #resume all work as expected.'
end

#title_widthObject



50
51
52
# File 'lib/progress_bar/depreciable.rb', line 50

def title_width
  method_removal_message 'title_width', 'The formatter is now smart enough to handle any title you use.  Set the format for the bar as described here: https://github.com/jfelchner/ruby-progressbar'
end

#title_width=(value) ⇒ Object



54
55
56
# File 'lib/progress_bar/depreciable.rb', line 54

def title_width=(value)
  method_removal_message 'title_width=', 'The formatter is now smart enough to handle any title you use.  Set the format for the bar as described here: https://github.com/jfelchner/ruby-progressbar'
end