Sha256: c56592516a4d8cb874a2bb26720aed9d92955f720eb8b98bd9c9a3206c15f3ae
Contents?: true
Size: 968 Bytes
Versions: 9
Compression:
Stored size: 968 Bytes
Contents
# Copyright (C) 2015 TopCoder Inc., All Rights Reserved. require 'sax-machine' require 'ce-greenbutton/elements/gb_entry' module GreenButton module Parser # a sax-machine mapping for the espi:DataFeed structure # # For example: # data_feed = GbDataFeed.parse(open(data_feed.xml)) # # # Author: ahmed.seddiq # Version: 1.0 class GbDataFeed include SAXMachine elements :entry, class: GbEntry, as: :entries # Get the related entry to the given entry of the given type # # entry - the parent entry. # type - the type of the required entry,e.g. 'MeterReading' # # Note: This method should be only called on instances returned from Parser.parse # method. # # Returns the related GbEntry def get_related (entry, type) related_entry_key = entry.related[type] unless entry.related.nil? self.entries[related_entry_key] end end end end
Version data entries
9 entries across 9 versions & 1 rubygems