Class: Sod::Graph::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/sod/graph/runner.rb

Overview

Runs the appropriate parser for given command line arguments.

Constant Summary collapse

HELP_PATTERN =
/
  \A       # Start of string.
  -h       # Short alias.
  |        # Or.
  --help   # Long alias.
  \Z       # End of string.
/x

Instance Method Summary collapse

Constructor Details

#initialize(graph, help_pattern: HELP_PATTERN, loader: Loader) ⇒ Runner

rubocop:todo Metrics/ParameterLists



20
21
22
23
24
25
26
# File 'lib/sod/graph/runner.rb', line 20

def initialize(graph, help_pattern: HELP_PATTERN, loader: Loader, **)
  super(**)
  @graph = graph
  @registry = loader.new(graph).call
  @help_pattern = help_pattern
  @lineage = +""
end

Instance Method Details

#call(arguments = ARGV) ⇒ Object

:reek:DuplicateMethodCall :reek:TooManyStatements



31
32
33
34
35
36
37
38
39
# File 'lib/sod/graph/runner.rb', line 31

def call arguments = ARGV
  lineage.clear
  visit arguments.dup
rescue OptionParser::ParseError => error
  log_error error.message
rescue Sod::Error => error
  log_error error.message
  help
end