Class: SyntaxTree::CLI::Options
- Inherits:
-
Object
- Object
- SyntaxTree::CLI::Options
- Defined in:
- lib/syntax_tree/cli.rb
Overview
This represents all of the options that can be passed to the CLI. It is responsible for parsing the list and then returning the file paths at the end.
Instance Attribute Summary collapse
-
#plugins ⇒ Object
readonly
Returns the value of attribute plugins.
-
#print_width ⇒ Object
readonly
Returns the value of attribute print_width.
-
#scripts ⇒ Object
readonly
Returns the value of attribute scripts.
-
#target_ruby_version ⇒ Object
readonly
Returns the value of attribute target_ruby_version.
Instance Method Summary collapse
-
#initialize(print_width: DEFAULT_PRINT_WIDTH) ⇒ Options
constructor
A new instance of Options.
-
#parse(arguments) ⇒ Object
TODO: This function causes a couple of side-effects that I really don’t like to have here.
Constructor Details
#initialize(print_width: DEFAULT_PRINT_WIDTH) ⇒ Options
Returns a new instance of Options.
263 264 265 266 267 268 |
# File 'lib/syntax_tree/cli.rb', line 263 def initialize(print_width: DEFAULT_PRINT_WIDTH) @plugins = [] @print_width = print_width @scripts = [] @target_ruby_version = nil end |
Instance Attribute Details
#plugins ⇒ Object (readonly)
Returns the value of attribute plugins.
261 262 263 |
# File 'lib/syntax_tree/cli.rb', line 261 def plugins @plugins end |
#print_width ⇒ Object (readonly)
Returns the value of attribute print_width.
261 262 263 |
# File 'lib/syntax_tree/cli.rb', line 261 def print_width @print_width end |
#scripts ⇒ Object (readonly)
Returns the value of attribute scripts.
261 262 263 |
# File 'lib/syntax_tree/cli.rb', line 261 def scripts @scripts end |
#target_ruby_version ⇒ Object (readonly)
Returns the value of attribute target_ruby_version.
261 262 263 |
# File 'lib/syntax_tree/cli.rb', line 261 def target_ruby_version @target_ruby_version end |
Instance Method Details
#parse(arguments) ⇒ Object
TODO: This function causes a couple of side-effects that I really don’t like to have here. It mutates the global state by requiring the plugins, and mutates the global options hash by adding the target ruby version. That should be done on a config-by-config basis, not here.
274 275 276 |
# File 'lib/syntax_tree/cli.rb', line 274 def parse(arguments) parser.parse!(arguments) end |