Class: Ruboclean::Runner::Options

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

Overview

Consolidates cli_arguments with “smart” defaults

Defined Under Namespace

Classes: Input, Output

Instance Method Summary collapse

Constructor Details

#initialize(cli_arguments:) ⇒ Options

Returns a new instance of Options.



7
8
9
# File 'lib/ruboclean/runner/options.rb', line 7

def initialize(cli_arguments:)
  @cli_arguments = cli_arguments
end

Instance Method Details

#input_pathObject



15
16
17
# File 'lib/ruboclean/runner/options.rb', line 15

def input_path
  input.input_path
end

#input_streamObject



11
12
13
# File 'lib/ruboclean/runner/options.rb', line 11

def input_stream
  input.stream
end

#output_streamObject



19
20
21
# File 'lib/ruboclean/runner/options.rb', line 19

def output_stream
  output.stream
end

#preserve_comments?Boolean

Returns:

  • (Boolean)


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

def preserve_comments?
  cli_arguments.preserve_comments?
end

#preserve_paths?Boolean

Returns:

  • (Boolean)


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

def preserve_paths?
  cli_arguments.preserve_paths?
end

#silent?Boolean

Returns:

  • (Boolean)


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

def silent?
  cli_arguments.silent? || output.stdout?
end

#verbose?Boolean

Returns:

  • (Boolean)


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

def verbose?
  !silent?
end

#verify?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/ruboclean/runner/options.rb', line 39

def verify?
  cli_arguments.verify?
end