Class: Torque::DateSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/torque/date_settings.rb

Overview

Determines the date range for a release notes generation

Instance Method Summary collapse

Constructor Details

#initialize(options, last_run_path, fs) ⇒ DateSettings

Returns a new instance of DateSettings.

Parameters:

  • options

    A hash of the command line options used to run Torque

  • last_run_path

    The path to the lastRun file

  • fs

    An instance of the FileSystem class



13
14
15
16
17
18
19
20
21
# File 'lib/torque/date_settings.rb', line 13

def initialize(options, last_run_path, fs)
  @options = options
  @last_run_path = last_run_path
  @fs = fs

  @current_date = Date.today
  @beginning_of_time = Date.new(1900, 1, 1)
  @date_format = "%Y-%m-%d"
end

Instance Method Details

#custom_date_range?Boolean

Returns True if the date range was set manually via command line, else false.

Returns:

  • (Boolean)

    True if the date range was set manually via command line, else false



34
35
36
37
# File 'lib/torque/date_settings.rb', line 34

def custom_date_range?
  generate_dates if !@custom_date_range
  return @custom_date_range
end

#get_datesaccept_from, accept_to

Generates the accept_from and accept_to dates if they don’t already exist

Returns:

  • (accept_from, accept_to)


27
28
29
30
# File 'lib/torque/date_settings.rb', line 27

def get_dates
  generate_dates if !@accept_from || !@accept_to
  return @accept_from, @accept_to
end