Sha256: dbdb0fb37ed8ebbcc046938c3e1e14d4b9b13ff4ab88b54d3c207add8d49feff
Contents?: true
Size: 497 Bytes
Versions: 1
Compression:
Stored size: 497 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}.+[a-zA-Z]{2}\d{3}-\d{4})') 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.8 | lib/parse_p1/base.rb |