Sha256: a15060257b7c085f51cb88c511f00951a18b0ecfe10dc6783c7685daab15622a
Contents?: true
Size: 478 Bytes
Versions: 1
Compression:
Stored size: 478 Bytes
Contents
# encoding: UTF-8 module ParseP1 class Base include ParseP1::Electricity include ParseP1::Gas attr_reader :data def initialize(data) @data = data end def valid? !data.match(/!$/).nil? && !device_id.nil? end def device_id match_within_one_p1_record('\/([a-zA-Z]{3}\d{1}.+)\r$') end private def match_within_one_p1_record(pattern) data.match(/[\W|\w]*#{pattern}[\W|\w]*!/) $1 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
parse_p1-0.0.7 | lib/parse_p1/base.rb |