3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/wasserstand/commandline.rb', line 3
def self.get(params = [])
case params.size
when 0
present_waterway(Wasserstand::Waterway.all)
when 1 waterway = Wasserstand::Waterway[params.first]
if waterway
present_waterway(waterway)
else
present_level(Wasserstand::Level[params.first])
end
when 2 if waterway = Wasserstand::Waterway[params.first]
present_level(waterway.levels[params.last])
else
STDERR.puts "No matching waterway found."
end
else
raise "Unexpected number of parameters."
end
end
|