3 ms·
I’ve used date libraries from several languages and they’re all pretty awkward, but Ruby seems to have a very elegant solution thanks to the fact that primitive
by temporallobe 2y ago
I’ve used date libraries from several languages and they’re all pretty awkward, but Ruby seems to have a very elegant solution thanks to the fact that primitives are also objects, so for example you can write things like 1.minute.ago or 1.day.from.now, which really helps in quick code comprehension.
- sensanaty 2y agoThat would actually be ActiveSupport, which does many things and the pain of its absence is quickly felt in any non-Rails codebase :) https://rubygems.org/gems/activesupport https://rubygems.org/gems/activesupport
- temporallobe 2y agoYea, I forgot to mention that this was in a Rails context. In any case this is only possible because of Ruby’s primitives-as-objects design.