Class: WeatherSage::CLI::Commands::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/weather-sage/cli/commands/command.rb

Overview

Base class for command-line commands.

You should subclass this class to create new commands.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ctx, app) ⇒ Command

Do not invoke this method directly; subclass Command and override the run method.



11
12
13
14
15
16
# File 'lib/weather-sage/cli/commands/command.rb', line 11

def initialize(ctx, app)
  @ctx, @app = ctx, app

  # create geocoder
  @geocoder = ::WeatherSage::Census::Geocoder.new(ctx)
end

Class Method Details

.run(ctx, app, args) ⇒ Object

Run command.



21
22
23
# File 'lib/weather-sage/cli/commands/command.rb', line 21

def self.run(ctx, app, args)
  new(ctx, app).run(args)
end

Instance Method Details

#run(args) ⇒ Object

Virtual method. You need to subclass and override this method to add a new command.



29
30
31
# File 'lib/weather-sage/cli/commands/command.rb', line 29

def run(args)
  raise "not implemented"
end