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
-
.mode ⇒ Object
Returns the value of attribute mode.
-
.services ⇒ Object
Returns the value of attribute services.
-
.url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
-
.populate(options = {}) ⇒ Object
Populates the environment from the given options hash, which was passed in through rack.
-
.register_service(path, service) ⇒ Object
Used to register a service for use with the ServiceManager middleware.
Class Attribute Details
.mode ⇒ Object
Returns the value of attribute mode.
8 9 10 |
# File 'lib/rack/amf/environment.rb', line 8 def mode @mode end |
.services ⇒ Object
Returns the value of attribute services.
8 9 10 |
# File 'lib/rack/amf/environment.rb', line 8 def services @services end |
.url ⇒ Object
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 ={} #:nodoc: url = [:url] if .key?(:url) mode = [:mode] if .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 |