class Parsers::Base
Constants
- PREFIX
Attributes
batch[R]
prefix[R]
xml[R]
Public Class Methods
new(batch, xml, prefix: nil, tags: nil)
click to toggle source
# File lib/parsers/base.rb, line 7 def initialize(batch, xml, prefix: nil, tags: nil) @batch = batch @xml = xml @prefix = prefix @tags = tags end
Protected Instance Methods
gauge(xml_key, key)
click to toggle source
# File lib/parsers/base.rb, line 16 def gauge(xml_key, key) value = xml.xpath(xml_key).text return if value.empty? if tags batch.gauge(key_for(key), value, tags: tags) else batch.gauge(key_for(key), value) end end
key_for(key)
click to toggle source
# File lib/parsers/base.rb, line 27 def key_for(key) [PREFIX, prefix, key].compact.join('.') end