Skip to content

Instantly share code, notes, and snippets.

@jodosha
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jodosha/9133028 to your computer and use it in GitHub Desktop.
Save jodosha/9133028 to your computer and use it in GitHub Desktop.
Lotus FAQs

Lotus::Router

Why Lotus::Router uses internally http_router?

Because I consider http_router like an excellent low level adapter. I needed to start with a certain degree of code maturity, and build on top of it the public API that I wanted for Lotus.

Lotus::Utils

What's the purpose of Lotus::Utils?

It's designed to enhance Ruby code and stdlib for the internal mechanisms of Lotus frameworks. It's not intended to be a replacement of ActiveSupport, which offers an excellent set of features for developers. In other words, they have a different purpose and a different target.

Why Lotus::Utils and not ActiveSupport?

Because AS uses monkey-patching a lot, this causes Ruby default objects to be heavier. Object goes from 55 to 87 public methods, String from 164 to 239 (MRI 2.1.0 and AS 4.0.3). Lotus::Utils is for Lotus' internals, I didn't want to interfer with end developers usage.

Why Lotus::Utils doesn't uses Ruby's refinements?

Because Lotus targets both Ruby 2.0 and 2.1. This feature is experimental on the older version, whereas it's enabled by default on the latter. It seems too much to ask developers to recompile their Ruby VM only for a few utils.

Why Lotus::Utils use instance methods and not class methods? Because class methods resist to refactoring. Also, in case of multiple manipulations, compare yourself the two usages:

Lotus::Utils::String.underscore(Lotus::Utils::String.demodulize('string'))
# vs
Lotus::Utils::String.new('string').demodulize.underscore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment