Class: CleanFiles::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/clean_files/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arguments) ⇒ Runner

Returns a new instance of Runner.



11
12
13
14
15
16
17
# File 'lib/clean_files/runner.rb', line 11

def initialize(arguments)
  @arguments = arguments

  # Set defaults
  @options = Hash.new
  @options[:threshold] = 1.month.ago
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/clean_files/runner.rb', line 9

def options
  @options
end

Instance Method Details

#runObject

Parse options, check arguments, then process the command



20
21
22
23
24
25
26
27
28
# File 'lib/clean_files/runner.rb', line 20

def run

  if parsed_options? && arguments_valid?
    Cleaner.new(@options.delete(:paths), @options).start
  else
    output_usage
  end

end