-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started With IRB
This page provides information on how to get started with using irb in the OpenStudio API.
Since there is no plugin for the existing text editors for OpenStudio, in addition to the OpenStudio's repository on the NREL's github and doxygen documentation, irb is one of the best way to test different methods. Here, is an example of using irb in the command line to create the OpenStudio model and get the RunPeriod object:
irb
require 'openstudio'
model=OpenStudio::Model::Model.new
model.getRunPeriod
The other example is using irb to find the exiting fields in the OS:Building
object:
The results show that getBuilding has different fields such as Name and, Building Sector Type. For example, to get the name of the building, building.setName("This is a test to set the building name")
.
One of the best way to identify existing methods in the API is to benefit from the irb/completion
in the command line. When user type require 'irb/completion'
in the command line, user can use tab key to auto complete the command or provide suggestions. Here is an example of benefiting from the irb/completion
:
The results show that there are three methods starting with setN
for the building object.
If you have a specific OpenStudio building that need to call, you need to use irb -I build-make/OpenStudioCode-prefix/src/OpenStudioCore-build/ruby
to call this specific version.