Class: Ruboclean::CliArguments
- Inherits:
-
Object
- Object
- Ruboclean::CliArguments
- Defined in:
- lib/ruboclean/cli_arguments.rb
Overview
Reads command line arguments and exposes corresponding reader methods
Constant Summary collapse
- FLAG_DEFAULTS =
{ "--stdin" => false, "--output" => nil, "--silent" => false, "--preserve-comments" => false, "--preserve-paths" => false, "--verify" => false }.freeze
Instance Method Summary collapse
-
#initialize(command_line_arguments = []) ⇒ CliArguments
constructor
A new instance of CliArguments.
- #input ⇒ Object
- #output ⇒ Object
- #preserve_comments? ⇒ Boolean
- #preserve_paths? ⇒ Boolean
- #silent? ⇒ Boolean
- #stdin? ⇒ Boolean
- #verify? ⇒ Boolean
Constructor Details
#initialize(command_line_arguments = []) ⇒ CliArguments
Returns a new instance of CliArguments.
15 16 17 |
# File 'lib/ruboclean/cli_arguments.rb', line 15 def initialize(command_line_arguments = []) @command_line_arguments = Array(command_line_arguments) end |
Instance Method Details
#input ⇒ Object
19 20 21 |
# File 'lib/ruboclean/cli_arguments.rb', line 19 def input @input ||= find_input end |
#output ⇒ Object
27 28 29 |
# File 'lib/ruboclean/cli_arguments.rb', line 27 def output flag_arguments.fetch("--output") end |
#preserve_comments? ⇒ Boolean
35 36 37 |
# File 'lib/ruboclean/cli_arguments.rb', line 35 def preserve_comments? flag_arguments.fetch("--preserve-comments") end |
#preserve_paths? ⇒ Boolean
39 40 41 |
# File 'lib/ruboclean/cli_arguments.rb', line 39 def preserve_paths? flag_arguments.fetch("--preserve-paths") end |
#silent? ⇒ Boolean
31 32 33 |
# File 'lib/ruboclean/cli_arguments.rb', line 31 def silent? flag_arguments.fetch("--silent") end |
#stdin? ⇒ Boolean
23 24 25 |
# File 'lib/ruboclean/cli_arguments.rb', line 23 def stdin? flag_arguments.fetch("--stdin") end |
#verify? ⇒ Boolean
43 44 45 |
# File 'lib/ruboclean/cli_arguments.rb', line 43 def verify? flag_arguments.fetch("--verify") end |