Module: Jellyfish
- Defined in:
- lib/jellyfish.rb,
lib/jellyfish/json.rb,
lib/jellyfish/urlmap.rb,
lib/jellyfish/builder.rb,
lib/jellyfish/rewrite.rb,
lib/jellyfish/version.rb,
lib/jellyfish/newrelic.rb,
lib/jellyfish/websocket.rb,
lib/jellyfish/chunked_body.rb,
lib/jellyfish/normalized_path.rb,
lib/jellyfish/normalized_params.rb
Defined Under Namespace
Modules: DSL, Json, NewRelic, NormalizedParams, NormalizedPath, WebSocket
Classes: Builder, ChunkedBody, Controller, Found, InternalError, NotFound, Response, Rewrite, URLMap
Constant Summary
collapse
- Cascade =
Object.new
- GetValue =
Object.new
- VERSION =
'1.1.1'
Instance Method Summary
collapse
Instance Method Details
#call(env) ⇒ Object
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
# File 'lib/jellyfish.rb', line 185
def call env
ctrl = self.class.controller.new(self.class.routes, self)
case res = catch(:halt){ ctrl.call(env) }
when Cascade
cascade(ctrl, env)
when Response
handle(ctrl, res, env['rack.errors'])
when Array
res
when NilClass ctrl.block_call(nil, lambda{|_|_})
else
raise TypeError.new("Expect the response to be a Jellyfish::Response" \
" or Rack triple (Array), but got: #{res.inspect}")
end
rescue => e
handle(ctrl, e, env['rack.errors'])
end
|
#initialize(app = nil) ⇒ Object
183
|
# File 'lib/jellyfish.rb', line 183
def initialize app=nil; @app = app; end
|
#log(msg, stderr) ⇒ Object
209
210
211
212
|
# File 'lib/jellyfish.rb', line 209
def log msg, stderr
return unless stderr
stderr.puts("[#{self.class.name}] #{msg}")
end
|
#log_error(e, stderr) ⇒ Object
204
205
206
207
|
# File 'lib/jellyfish.rb', line 204
def log_error e, stderr
return unless stderr
stderr.puts("[#{self.class.name}] #{e.inspect} #{e.backtrace}")
end
|