From 416324f60e0dac53f25453aa7da67dfdb9eaa52d Mon Sep 17 00:00:00 2001 From: otherl Date: Sun, 17 Aug 2014 19:51:14 +0100 Subject: Fixed a bug that caused multi word station names to be parsed incorrectly. Fixed a formatting bug in the travel time output. --- blatube.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'blatube.rb') diff --git a/blatube.rb b/blatube.rb index 12de2c0..af67aeb 100644 --- a/blatube.rb +++ b/blatube.rb @@ -18,7 +18,7 @@ VERSION = 'v1.3.1' INFINITY = 1 << 64 WEIGHTS = ['distance','peak_time','off_peak_time','unimpeded_time'] -STDIN.gets.split(' ').each{|arg| ARGV << arg} if ARGV == [] +STDIN.gets.split('-').drop(1).map {|arg| ('-'+arg).rstrip.split(/ /,2)}.flatten.each{|arg| ARGV << arg} if ARGV == [] args = ARGV.dup options = OptionParser.new do |opts| @@ -180,7 +180,7 @@ def build_route_output else minutes = @distances[@to_station.upcase].round(2) seconds = (minutes - minutes.to_i) * 60 - @output << "Travel Time: #{minutes.to_i}:#{seconds.round}" + @output << "Travel Time: #{minutes.to_i}:#{seconds.round.to_s.rjust(2, '0')}" end end -- cgit v1.2.3