Module: ParseP1::Gas
- Included in:
- Base
- Defined in:
- lib/parse_p1/gas.rb
Instance Method Summary collapse
- #gas_meter_id ⇒ Object
- #gas_usage ⇒ Object
-
#last_hourly_reading_gas ⇒ Object
Only 2 digits for year!.
- #measurement_unit_gas ⇒ Object
Instance Method Details
#gas_meter_id ⇒ Object
7 8 9 |
# File 'lib/parse_p1/gas.rb', line 7 def gas_meter_id match_within_one_p1_record('[1|2]:96\.1\.0\S(\d{1,96})\S') end |
#gas_usage ⇒ Object
21 22 23 24 |
# File 'lib/parse_p1/gas.rb', line 21 def gas_usage result = match_within_one_p1_record('\S0-[1|2]:24\.2\.1\S\S\w+\S\W{1,2}\S(\d{5}\.\d{3})\S') result.to_f if result end |
#last_hourly_reading_gas ⇒ Object
Only 2 digits for year!
12 13 14 15 |
# File 'lib/parse_p1/gas.rb', line 12 def last_hourly_reading_gas result = match_within_one_p1_record('0-[1|2]: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 |
#measurement_unit_gas ⇒ Object
17 18 19 |
# File 'lib/parse_p1/gas.rb', line 17 def measurement_unit_gas match_within_one_p1_record('0-[1|2]:24\.2\.1\S\S(\w+)\S') end |