Sha256: 8c2fec3b334f215898e458811f7ce557728a52f84b560124b5a2ed6caaa3d96c
Contents?: true
Size: 668 Bytes
Versions: 2
Compression:
Stored size: 668 Bytes
Contents
# encoding: UTF-8 module ParseP1 module Gas def gas_meter_id match_within_one_p1_record('1:96\.1\.0\S(\d{1,96})\S') end #Only 2 digits for year! def last_hourly_reading_gas result = match_within_one_p1_record('0-1:24\.3\.0\S(\d{12})\S') DateTime.new(('20'+result[0..1]).to_i, result[2..3].to_i, result[4..5].to_i, result[6..7].to_i, result[8..9].to_i) if result end def measurement_unit_gas match_within_one_p1_record('0-1:24\.2\.1\S\S(\w+)\S') end def gas_usage result = match_within_one_p1_record('\S0-1:24\.2\.1\S\S\w+\S\W{1,2}\S(\d{5}\.\d{3})\S') result.to_f if result end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
parse_p1-0.0.9 | lib/parse_p1/gas.rb |
parse_p1-0.0.8 | lib/parse_p1/gas.rb |