summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorotherl <lgdmiller@gmail.com>2014-08-17 19:51:14 +0100
committerotherl <lgdmiller@gmail.com>2014-08-17 19:58:01 +0100
commit416324f60e0dac53f25453aa7da67dfdb9eaa52d (patch)
tree148473366d903b93dbeea9c4ba8593551eec0d7d
parent610eee148281ac5b86dd76ce09841d72379ea4b7 (diff)
Fixed a bug that caused multi word station names to be parsed incorrectly. Fixed a formatting bug in the travel time output.
-rw-r--r--blatube.rb4
1 files changed, 2 insertions, 2 deletions
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