Module: Umbra
- Defined in:
- lib/umbra.rb,
lib/umbra/config.rb,
lib/umbra/encoder.rb,
lib/umbra/version.rb,
lib/umbra/publisher.rb,
lib/umbra/middleware.rb,
lib/umbra/pb/umbra_pb.rb
Defined Under Namespace
Modules: Pb
Classes: Config, Encoder, Middleware, Publisher
Constant Summary
collapse
- CHANNEL =
"umbra_channel"
"HTTP_X_UMBRA_REQUEST"
"true"
- RequestSelector =
proc { true }
- SuppressErrorHandler =
proc {}
- VERSION =
"0.3.0"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config.
21
22
23
|
# File 'lib/umbra.rb', line 21
def config
@config
end
|
Class Method Details
23
24
25
26
27
|
# File 'lib/umbra.rb', line 23
def configure(&block)
@config = Config.default(&block)
test_redis_connection!
end
|
.encoder ⇒ Object
46
47
48
|
# File 'lib/umbra.rb', line 46
def encoder
@config.encoder
end
|
.logger ⇒ Object
50
51
52
|
# File 'lib/umbra.rb', line 50
def logger
@config.logger
end
|
.publish(env) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/umbra.rb', line 29
def publish(env)
return if umbra_request?(env)
return unless @config
return unless @config.request_selector.call(env)
env["umbra.request_body"] = request_body(env)
@config.publisher.call(env)
rescue => e
@config.error_handler.call(e, env)
end
|
.redis ⇒ Object
42
43
44
|
# File 'lib/umbra.rb', line 42
def redis
@redis ||= Redis.new(@config.redis_options)
end
|
.reset! ⇒ Object
54
55
56
57
|
# File 'lib/umbra.rb', line 54
def reset!
@config = nil
@redis = nil
end
|