Class: UserData

Inherits:
Object
  • Object
show all
Defined in:
lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_enums.rb

Class Method Summary collapse

Class Method Details

.compare(one, another) ⇒ Boolean

Compare the two UserData enums are the same or not. Static method.

Parameters:

  • one (String)

    one UserData type enum

  • another (String)

    another UserDataType enum

Returns:

  • (Boolean)

    if the two enums or strings are the same



23
24
25
# File 'lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_enums.rb', line 23

def self.compare(one, another)
  return one && another && !one.empty? && !another.empty? && one.downcase.strip == another.downcase.strip
end

.get_constant_valuesObject

Static method that retrieves the function constant values in a list



3
4
5
# File 'lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_enums.rb', line 3

def self.get_constant_values
  return constants.map(&method(:const_get))
end

.matched_any?(user_data) ⇒ Boolean

Static method to check if a user data matches to any of the constant value

Parameters:

  • user_data (String)

    a user data

Returns:

  • (Boolean)

    matched any, else false



11
12
13
14
15
16
17
# File 'lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_enums.rb', line 11

def self.matched_any?(user_data)
  userdata_constants = get_constant_values
  userdata_constants.each do |constant|
    return true if compare(user_data, constant)
  end
  return false
end