Class: BuildingSync::Utility

Inherits:
Object
  • Object
show all
Includes:
Helper, XmlGetSet
Defined in:
lib/buildingsync/utility.rb

Overview

Utility class

Instance Method Summary collapse

Methods included from XmlGetSet

#get_prefix, #xget_attribute_for_element, #xget_element, #xget_id, #xget_idrefs, #xget_linked_premises, #xget_name, #xget_or_create, #xget_plurals_text_value, #xget_text, #xget_text_as_bool, #xget_text_as_date, #xget_text_as_dt, #xget_text_as_float, #xget_text_as_integer, #xset_or_create, #xset_text

Methods included from Helper

#help_calculate_hours, #help_convert, #help_count_number_of_days, #help_element_class_type_check, #help_get_attribute_value, #help_get_default_schedule_set, #help_get_duration, #help_get_end_time, #help_get_end_time_sat, #help_get_end_time_sun, #help_get_end_time_weekday, #help_get_or_create, #help_get_schedule_rule_set_from_schedule, #help_get_start_time, #help_get_start_time_sat, #help_get_start_time_sun, #help_get_start_time_weekday, #help_get_text_value, #help_get_text_value_as_bool, #help_get_text_value_as_date, #help_get_text_value_as_datetime, #help_get_text_value_as_float, #help_get_text_value_as_integer, #help_get_zone_name_list, #help_load_doc, #help_print_all_schedules, #help_print_schedule, #help_write_profile

Constructor Details

#initialize(base_xml, ns) ⇒ Utility

Returns a new instance of Utility.

Parameters:

  • base_xml (REXML::Element)
  • ns (String)


47
48
49
50
51
# File 'lib/buildingsync/utility.rb', line 47

def initialize(base_xml, ns)
  @base_xml = base_xml
  @ns = ns
  help_element_class_type_check(base_xml, 'Utility')
end

Instance Method Details

#get_rate_schedulesArray<REXML::Element>

Returns:

  • (Array<REXML::Element>)


54
55
56
57
58
59
60
# File 'lib/buildingsync/utility.rb', line 54

def get_rate_schedules
  rs = []
  @base_xml.elements.each("#{@ns}:RateSchedules/#{@ns}:RateSchedule") do |rate_schedule|
    rs << rate_schedule
  end
  return rs
end

#get_utility_meter_numbersArray<String>

Returns:

  • (Array<String>)


63
64
65
# File 'lib/buildingsync/utility.rb', line 63

def get_utility_meter_numbers
  return xget_plurals_text_value('UtilityMeterNumber')
end