Class: Ruboclean::Runner

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

Overview

Entry point for processing

Instance Method Summary collapse

Constructor Details

#initialize(args = []) ⇒ Runner

Returns a new instance of Runner.



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

def initialize(args = [])
  @cli_arguments = CliArguments.new(args)
end

Instance Method Details

#changed?(target_yaml) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/ruboclean/runner.rb', line 23

def changed?(target_yaml)
  target_yaml != source_yaml
end

#pathObject



35
36
37
# File 'lib/ruboclean/runner.rb', line 35

def path
  cli_arguments.path
end

#run!Object



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

def run!
  return if source_file_pathname.empty?

  load_file.then(&method(:order))
           .then(&method(:cleanup_paths))
           .then(&method(:convert_to_yaml))
           .then(&method(:write_file!))
           .then(&method(:changed?))
end

#verbose?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/ruboclean/runner.rb', line 27

def verbose?
  cli_arguments.verbose?
end

#verify?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/ruboclean/runner.rb', line 31

def verify?
  cli_arguments.verify?
end