Class: SyntaxTree::CLI::Options

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeOptions

Returns a new instance of Options.



384
385
386
387
388
389
390
# File 'lib/syntax_tree/cli.rb', line 384

def initialize
  @ignore_files = []
  @plugins = []
  @print_width = DEFAULT_PRINT_WIDTH
  @scripts = []
  @target_ruby_version = DEFAULT_RUBY_VERSION
end

Instance Attribute Details

#ignore_filesObject (readonly)

Returns the value of attribute ignore_files.



378
379
380
# File 'lib/syntax_tree/cli.rb', line 378

def ignore_files
  @ignore_files
end

#pluginsObject (readonly)

Returns the value of attribute plugins.



378
379
380
# File 'lib/syntax_tree/cli.rb', line 378

def plugins
  @plugins
end

Returns the value of attribute print_width.



378
379
380
# File 'lib/syntax_tree/cli.rb', line 378

def print_width
  @print_width
end

#scriptsObject (readonly)

Returns the value of attribute scripts.



378
379
380
# File 'lib/syntax_tree/cli.rb', line 378

def scripts
  @scripts
end

#target_ruby_versionObject (readonly)

Returns the value of attribute target_ruby_version.



378
379
380
# File 'lib/syntax_tree/cli.rb', line 378

def target_ruby_version
  @target_ruby_version
end

Instance Method Details

#formatter_optionsObject



392
393
394
395
# File 'lib/syntax_tree/cli.rb', line 392

def formatter_options
  @formatter_options ||=
    Formatter::Options.new(target_ruby_version: target_ruby_version)
end

#parse(arguments) ⇒ Object



397
398
399
# File 'lib/syntax_tree/cli.rb', line 397

def parse(arguments)
  parser.parse!(arguments)
end