/explore
|
You are here |
newvick.com | ||
| | | | |
ngauthier.com
[AI summary] A guide explaining how to use presenters in Ruby on Rails to transform ActiveRecord models into specific JSON formats. |
|
| | | | | ||
| | | | |
tenderlovemaking.com
TL;DR: Rack API is poor when you consider streaming response bodies. class FooApplication class ErbPage def to_a head = "the head tag" sleep(2) body = "the body tag" sleep(2) [head, body] end end def call(env) [200, {}, ErbPage.new.to_a] end end class FakeRack def serve(application) status, headers, body = application.call({}) p :status => status p :headers => headers body.each do |string| p string end body.close if body.respond_to?(:close) end end app = FooApplication.new rack = FakeRack.new rack.serve app $ time ruby foo.rb {:status=>200} {:headers=>{}} "the head tag" "the body tag" real 0m4.008s user 0m0.003s sys 0m0.003s class ResponseTimer def initialize(app) @app = app end def call(env) now = Time.now status, headers, body = @app.call(env) headers['X-R... |
|
| | | | | ||
| | | | |
kaukas.mataroa.blog
[AI summary] A developer reflects on failing an idiomatic Ruby interview due to a specific coding style choice regarding logic in constructors versus memoization and class design. |
|
| | | | | ||
| | | | |
jonathanbayless.com
The blog of Jonathan Bayless |
|
| | | |||