Class: OEHClient::Config::SpaceManager
- Inherits:
-
Object
- Object
- OEHClient::Config::SpaceManager
- Includes:
- Singleton
- Defined in:
- lib/oehclient/config/space_manager.rb
Instance Attribute Summary collapse
-
#spaces ⇒ Object
Returns the value of attribute spaces.
Instance Method Summary collapse
-
#get(site_key) ⇒ Object
get_space returns the instance of the OEHClient::Config::Space.
-
#initialize ⇒ SpaceManager
constructor
Constructor.
-
#register_space(space_config = {}) ⇒ Object
register_space is a wrapper method that converts the passed Hash object to an instance of the OEHClient::Config::Space object, which is passed to the register method.
Constructor Details
permalink #initialize ⇒ SpaceManager
Constructor. Initialize the spaces collection as a new hash
10 11 12 |
# File 'lib/oehclient/config/space_manager.rb', line 10 def initialize @spaces = Hash.new end |
Instance Attribute Details
permalink #spaces ⇒ Object
Returns the value of attribute spaces.
7 8 9 |
# File 'lib/oehclient/config/space_manager.rb', line 7 def spaces @spaces end |
Instance Method Details
permalink #get(site_key) ⇒ Object
get_space returns the instance of the OEHClient::Config::Space
24 25 26 27 28 29 30 31 32 |
# File 'lib/oehclient/config/space_manager.rb', line 24 def get(site_key) # raise the OEHClient::Exception::InvalidSpaceException if the space has not been registered raise OEHClient::Exception::InvalidSpaceException unless (@spaces.has_key?(site_key)) # return the space configuration instance @spaces[site_key] end |
permalink #register_space(space_config = {}) ⇒ Object
register_space is a wrapper method that converts the passed Hash object to an instance of the
OEHClient::Config::Space object, which is passed to the register method
16 17 18 19 20 21 |
# File 'lib/oehclient/config/space_manager.rb', line 16 def register_space(space_config={}) # Pass a new instance of the space object to the register_space method register(OEHClient::Config::Space.create(space_config)) end |