class WeatherSage::CLI::Commands::Command
Base class for command-line commands.
You should subclass this class to create new commands.
Public Class Methods
new(ctx, app)
click to toggle source
Do not invoke this method directly; subclass Command
and override the run
method.
# 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
run(ctx, app, args)
click to toggle source
Run command.
# File lib/weather-sage/cli/commands/command.rb, line 21 def self.run(ctx, app, args) new(ctx, app).run(args) end
Public Instance Methods
run(args)
click to toggle source
Virtual method. You need to subclass and override this method to add a new command.
# File lib/weather-sage/cli/commands/command.rb, line 29 def run(args) raise "not implemented" end
Protected Instance Methods
geocode(s)
click to toggle source
Geocode given street address and return array of Census::Geocode::Match results.
# File lib/weather-sage/cli/commands/command.rb, line 39 def geocode(s) @geocoder.run(s) end