Лекция, в която представям възгледите си за писането на документация и няколко мои експериментални tool-чета за улесняване на процеса по документиране на код.
@h = h.to_f end def call(x, y) k1 = h * f(x, y) k2 = h * f(x + h/2, y + k1/2) k3 = h * f(x + h, y - k1 + 2*k2) y + (1.0/6.0) * (k1 + 4*k2 + k3) end def f(*args) @f.call(*args) end end
# `Environment`. # # The expection is that all of its file system # methods are cached for the instances lifetime. # This makes `Index` much faster. This behavior # is ideal in production environments where the # file system is immutable. # # `Index` should not be initialized directly. # Instead use `Environment#index`. class Index < Base # ... end end
is an instance of `Environment`. That class implements the rack interface, so you could simply `run Sprockets::Environment.new` and get a rack server up that serves assets. For production use, you can use the `index` method to get an `Index` object, which is read-only and therefore faster.