Class: Honeybee::Extension
- Inherits:
-
OpenStudio::Extension::Extension
- Object
- OpenStudio::Extension::Extension
- Honeybee::Extension
- Defined in:
- lib/honeybee/extension.rb
Constant Summary collapse
- @@schema =
nil
- @@standards =
nil
Instance Method Summary collapse
-
#doc_templates_dir ⇒ Object
Doc templates are common files like copyright files which are used to update measures Doc templates will only be applied when the gem is a part of a repository Return the absolute path of the doc templates dir or nil if there is none.
-
#files_dir ⇒ Object
Relevant files such as the openapi JSON schema files for the honeybee model.
-
#initialize ⇒ Extension
constructor
Override parent class.
-
#measures_dir ⇒ Object
Return the absolute path of the measures or nil if there is none.
-
#schema ⇒ Object
return the model schema.
-
#schema_file ⇒ Object
return path to the model schema file.
-
#standards ⇒ Object
return the JSON of default standards.
-
#standards_file ⇒ Object
return path to the model standards file.
Constructor Details
#initialize ⇒ Extension
Override parent class
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/honeybee/extension.rb', line 43 def initialize super # Note that the root_dir is only meaningful when the gem is in a github repository # When installed as a Ruby gem, the highest directory within the gem is the lib_dir @root_dir = File.absolute_path(File.join(File.dirname(__FILE__), '..', '..')) @lib_dir = File.absolute_path(File.join(File.dirname(__FILE__), '..')) @instance_lock = Mutex.new @@schema ||= schema @@standards ||= standards end |
Instance Method Details
#doc_templates_dir ⇒ Object
Doc templates are common files like copyright files which are used to update measures Doc templates will only be applied when the gem is a part of a repository Return the absolute path of the doc templates dir or nil if there is none
72 73 74 |
# File 'lib/honeybee/extension.rb', line 72 def doc_templates_dir File.absolute_path(File.join(@root_dir, 'doc_templates')) end |
#files_dir ⇒ Object
Relevant files such as the openapi JSON schema files for the honeybee model. Return the absolute path of the files or nil if there is none. Used when configuring OSWs
65 66 67 |
# File 'lib/honeybee/extension.rb', line 65 def files_dir File.absolute_path(File.join(@lib_dir, 'files')) end |
#measures_dir ⇒ Object
Return the absolute path of the measures or nil if there is none. Can be used when configuring OSWs
58 59 60 |
# File 'lib/honeybee/extension.rb', line 58 def measures_dir File.absolute_path(File.join(@lib_dir, 'measures')) end |
#schema ⇒ Object
return the model schema
87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/honeybee/extension.rb', line 87 def schema @instance_lock.synchronize do if @@schema.nil? File.open(schema_file, 'r') do |f| @@schema = JSON.parse(f.read, symbolize_names: true) end end end @@schema end |
#schema_file ⇒ Object
return path to the model schema file
77 78 79 |
# File 'lib/honeybee/extension.rb', line 77 def schema_file File.join(@lib_dir, 'honeybee', '_defaults', 'model.json') end |
#standards ⇒ Object
return the JSON of default standards
100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/honeybee/extension.rb', line 100 def standards @instance_lock.synchronize do if @@standards.nil? File.open(standards_file, 'r') do |f| @@standards = JSON.parse(f.read, symbolize_names: true) end end end @@standards end |
#standards_file ⇒ Object
return path to the model standards file
82 83 84 |
# File 'lib/honeybee/extension.rb', line 82 def standards_file File.join(@lib_dir, 'honeybee', '_defaults', 'energy_default.json') end |