summaryrefslogtreecommitdiff
path: root/v1/test.rb
diff options
context:
space:
mode:
authorpks <pks@pks.rocks>2021-05-10 13:23:21 +0200
committerpks <pks@pks.rocks>2021-05-10 13:23:21 +0200
commit281fa36a24f81d87543a7791252954414e161565 (patch)
treeab45e491aa93924f7310303913f2df2d3f3b069f /v1/test.rb
parent69e11599c2194187e1c172ebe6b7b51945a7f306 (diff)
rm v0 v1
Diffstat (limited to 'v1/test.rb')
-rw-r--r--v1/test.rb27
1 files changed, 0 insertions, 27 deletions
diff --git a/v1/test.rb b/v1/test.rb
deleted file mode 100644
index 16ab18a..0000000
--- a/v1/test.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-int = Proc.new do |x|
- x.to_i
-end
-float = Proc.new do |x|
- x.to_f
-end
-str = Proc.new do |x|
- x.to_s
-end
-
-def parse_to_hash s, conv
- h = {}
- puts s.split("\t").map { |i| i=i.split("::"); "#{i[0]} #{conv[i[0]].call}" }
- return h
-end
-
-common_conv = { "db" => str, "timestamp"=>float, "device_type"=>str, "type"=>str, "device_id"=>str, "battery" => int, "battery_numeric" => int, "rssi" => int, "rssi_numeric" => int }
-rain_conv = {"rain_rate"=>float, "rain_total"=>float}.merge(common_conv)
-wind_conv = {"chill"=>float, "temperature"=>float,"average_speed"=>float,"direction"=>int,"gust"=>float}.merge(common_conv)
-temp_conv = {"humidity"=>float, "humidity_status"=>str,"humidity_status_numeric"=>int,"temperature"=>float}.merge(common_conv)
-conv = { "rain" => rain_conv, "wind" => wind_conv, "temp" => temp_conv }
-
-while line = STDIN.gets
- db = line.split("\t").first.split("::")[1]
- parse_to_hash line, conv[db]
-end
-