Module: Roda::RodaPlugins::Component
- Defined in:
- lib/roda/plugins/component.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods, RequestClassMethods, RequestMethods
Class Method Summary
collapse
Class Method Details
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/roda/plugins/component.rb', line 16
def self.configure(app, opts={})
if app.opts[:component]
app.opts[:component].merge!(opts)
else
app.opts[:component] = opts.dup
end
opts = app.opts[:component]
opts[:cache] = app.thread_safe_cache if opts.fetch(:cache, true)
opts[:path] ||= 'components'
opts[:route] ||= 'components'
opts[:debug] ||= false
opts[:assets_route] ||= 'assets/components'
opts[:class] ||= Roda::Component
opts[:settings] ||= {}
opts[:class_name] ||= {}
opts[:events] ||= {}
opts[:user_model] ||= 'User'
opts[:redis_uri] ||= 'redis://localhost:6379'
opts[:redis_namespace] ||= 'roda:component:'
opts[:cache][:tmpl] ||= {}
app.use(Faye::RackAdapter, {
mount: '/faye',
extensions: [
Roda::Component::Faye::CsrfProtection.new,
Roda::Component::Faye::ChannelManager.new
],
engine: {
type: Faye::Redis,
uri: opts[:redis_uri],
namespace: opts[:redis_namespace]
}
})
opts[:class].set_app app
end
|
.load_dependencies(app, opts = {}) ⇒ Object
12
13
14
|
# File 'lib/roda/plugins/component.rb', line 12
def self.load_dependencies(app, opts={})
Faye::WebSocket.load_adapter('thin')
end
|