Class: Ruboclean::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/ruboclean/runner.rb,
lib/ruboclean/runner/options.rb,
lib/ruboclean/runner/options/input.rb,
lib/ruboclean/runner/options/output.rb

Overview

Entry point for processing

Defined Under Namespace

Classes: Options

Instance Method Summary collapse

Constructor Details

#initialize(command_line_arguments = []) ⇒ Runner

Returns a new instance of Runner.



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

def initialize(command_line_arguments = [])
  cli_arguments = CliArguments.new(command_line_arguments)
  @options = Runner::Options.new(cli_arguments: cli_arguments)
end

Instance Method Details

#changed?(target_yaml) ⇒ Boolean

Returns:

  • (Boolean)


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

def changed?(target_yaml)
  target_yaml != source_yaml
end

#input_pathObject



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

def input_path
  options.input_path
end

#run!Object



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

def run!
  return if source_yaml.empty?

  parse_yaml.then(&method(:order))
            .then(&method(:cleanup_paths))
            .then(&method(:convert_to_yaml))
            .then(&method(:write_stream!))
            .then(&method(:changed?))
end

#verbose?Boolean

Returns:

  • (Boolean)


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

def verbose?
  options.verbose?
end

#verify?Boolean

Returns:

  • (Boolean)


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

def verify?
  options.verify?
end