Module: Rack::AMF::Environment

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

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.debugObject

Returns the value of attribute debug.



4
5
6
# File 'lib/rack/amf/environment.rb', line 4

def debug
  @debug
end

.modeObject

Returns the value of attribute mode.



4
5
6
# File 'lib/rack/amf/environment.rb', line 4

def mode
  @mode
end

.servicesObject

Returns the value of attribute services.



4
5
6
# File 'lib/rack/amf/environment.rb', line 4

def services
  @services
end

.urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/rack/amf/environment.rb', line 4

def url
  @url
end

Class Method Details

.log(data) ⇒ Object

:nodoc:



28
29
30
31
# File 'lib/rack/amf/environment.rb', line 28

def log data #:nodoc:
  return if !debug
  puts data
end

.populate(options = {}) ⇒ Object

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



22
23
24
25
26
# File 'lib/rack/amf/environment.rb', line 22

def populate options={} #:nodoc:
  url = options[:url] if options.key?(:url)
  debug = options[:debug] if options.key?(:debug)
  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


15
16
17
18
# File 'lib/rack/amf/environment.rb', line 15

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