Module: Rack::AMF::Environment

Defined in:
lib/rack/amf/environment.rb

Overview

Manages services if using the ServiceManager middleware, as well as the url to restrict AMF requests to, and the mode. The URL and mode are automatically set when you call use Rack::AMF, options in your rack application.

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.modeObject

Returns the value of attribute mode.



8
9
10
# File 'lib/rack/amf/environment.rb', line 8

def mode
  @mode
end

.servicesObject

Returns the value of attribute services.



8
9
10
# File 'lib/rack/amf/environment.rb', line 8

def services
  @services
end

.urlObject

Returns the value of attribute url.



8
9
10
# File 'lib/rack/amf/environment.rb', line 8

def url
  @url
end

Class Method Details

.populate(options = {}) ⇒ Object

Populates the environment from the given options hash, which was passed in through rack



25
26
27
28
# File 'lib/rack/amf/environment.rb', line 25

def populate options={} #:nodoc:
  url = options[:url] if options.key?(:url)
  mode = options[:mode] if options.key?(:mode)
end

.register_service(path, service) ⇒ Object

Used to register a service for use with the ServiceManager middleware. To register a service, simply pass in the root path for the service and an object that can receive service calls.

Example:

Rack::AMF::Environment.register_service 'SpecialService', SpecialService.new
Rack::AMF::Environment.register_service 'org.rack-amf.AMFService', AMFService.new


18
19
20
21
# File 'lib/rack/amf/environment.rb', line 18

def register_service path, service
  @services ||= {}
  @services[path] = service
end