Class: Dragnet::CLI::Base

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/dragnet/cli/base.rb

Overview

Base class for all CLI classes.

Direct Known Subclasses

Master

Constant Summary collapse

E_CONFIG_LOAD_ERROR =

Exit status codes

1

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Base

Creates a new instance of the class. Called by Thor when a command is executed. Creates a logger for the class passing Thor's shell to it (Thor's shell handles the output to the console)



37
38
39
40
# File 'lib/dragnet/cli/base.rb', line 37

def initialize(*args)
  super
  @logger = Dragnet::CLI::Logger.new(shell)
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



20
21
22
# File 'lib/dragnet/cli/base.rb', line 20

def configuration
  @configuration
end

#loggerObject (readonly)

Returns the value of attribute logger.



20
21
22
# File 'lib/dragnet/cli/base.rb', line 20

def logger
  @logger
end

Class Method Details

.exit_on_failure?Boolean

Tells Thor to return an unsuccessful return code (different from 0) if an error is raised.

Returns:

  • (Boolean)


30
31
32
# File 'lib/dragnet/cli/base.rb', line 30

def self.exit_on_failure?
  true
end