Class: Garufa::GarufaApp
- Inherits:
-
Goliath::API
- Object
- Goliath::API
- Garufa::GarufaApp
- Defined in:
- lib/garufa/garufa_app.rb
Instance Method Summary collapse
-
#options_parser(opts, options) ⇒ Object
Extend goliath options with our own options.
- #response(env) ⇒ Object
Instance Method Details
#options_parser(opts, options) ⇒ Object
Extend goliath options with our own options.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/garufa/garufa_app.rb', line 20 def (opts, ) [:port] = DEFAULT_PORT opts.on('-V', '--version', 'Display version and exit') { puts "Garufa version #{Garufa::VERSION}"; exit } opts.separator "" opts.separator "Pusher options:" = { app_id: ['--app_id APP_ID', 'Pusher application ID (required)'], app_key: ['--app_key APP_KEY', 'Pusher application key (required)'], secret: ['--secret SECRET', 'Pusher application secret (required)'] } .each do |k, v| opts.on(v.first, v.last) { |value| Garufa::Config[k] = value } end opts.on('--enable-client-events', 'Enable client events (default: false)') { Garufa::Config[:client_events_enabled] = true } end |
#response(env) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/garufa/garufa_app.rb', line 43 def response(env) if Faye::WebSocket.websocket?(env) WebSocket::Server.call(env) else API::Server.call(env) end end |