Class: OEHClient::Config::SpaceManager

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/oehclient/config/space_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSpaceManager

Constructor. Initialize the spaces collection as a new hash

[View source]

10
11
12
# File 'lib/oehclient/config/space_manager.rb', line 10

def initialize
	@spaces 	= Hash.new
end

Instance Attribute Details

#spacesObject

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

#get(site_key) ⇒ Object

get_space returns the instance of the OEHClient::Config::Space

[View source]

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

#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
[View source]

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