class Thundersnow::Bin
Public Class Methods
new(args)
click to toggle source
# File lib/thundersnow/bin.rb, line 4 def initialize(args) @args = args end
Public Instance Methods
run()
click to toggle source
# File lib/thundersnow/bin.rb, line 8 def run @weather = Weather.new(location) return "Could not locate weather for #{location}" unless @weather.valid? if show_forecast? show :forecast else show :current end end
Private Instance Methods
location()
click to toggle source
# File lib/thundersnow/bin.rb, line 22 def location @args.reject {|a| a =~ /^--/ }[0] end
show(name)
click to toggle source
# File lib/thundersnow/bin.rb, line 26 def show(name) @weather.send(name) end
show_forecast?()
click to toggle source
# File lib/thundersnow/bin.rb, line 30 def show_forecast? @args.include? '--forecast' end