Class: GreenButtonClasses::ReadingType

Inherits:
GreenButtonEntry show all
Defined in:
lib/greenbutton/gb_classes.rb

Constant Summary collapse

ATTRS =
['accumulationBehaviour', 'commodity', 'currency', 'dataQualifier', 'flowDirection', 'intervalLength',
'kind', 'phase', 'powerOfTenMultiplier', 'timeAttribute', 'uom']

Instance Attribute Summary collapse

Attributes inherited from GreenButtonEntry

#href_from_parent, #other_related, #related_hrefs

Instance Method Summary collapse

Methods inherited from GreenButtonEntry

#add_related_entry, #add_related_link, #all_rules, #assign_rule, #create_attributes, #entry_node, #find_by_href, #get_related_links, #initialize

Constructor Details

This class inherits a constructor from GreenButtonClasses::GreenButtonEntry

Instance Attribute Details

#meter_readingObject

Returns the value of attribute meter_reading



225
226
227
# File 'lib/greenbutton/gb_classes.rb', line 225

def meter_reading
  @meter_reading
end

Instance Method Details

#additional_rulesObject



237
238
239
240
241
242
243
244
# File 'lib/greenbutton/gb_classes.rb', line 237

def additional_rules
  rules = {}
  ATTRS.each do |attr|
    sym = Helper.underscore(attr).to_sym
    rules[sym] = Rule.new(sym , './/'+attr, :integer )
  end
  rules
end

#docObject



233
234
235
# File 'lib/greenbutton/gb_classes.rb', line 233

def doc
  self.meter_reading.doc
end

#pre_rule_assignment(parent) ⇒ Object



229
230
231
# File 'lib/greenbutton/gb_classes.rb', line 229

def pre_rule_assignment(parent)
  self.meter_reading = parent
end