Some book mentioned some gem to decorate numbers with #days
, #megabytes
, #minutes
etc. Is this only in ActiveSupport, or is there a smaller gem that provides this functionality for use in (small) non-rails gems? I want to use this functionality as part of a DSL in a tiny little gem.
相关问题
- Question marks after images and js/css files in ra
- Using :remote => true with hover event
- Eager-loading association count with Arel (Rails 3
- How to specify memcache server to Rack::Session::M
- Why am I getting a “C compiler cannot create execu
相关文章
- Ruby using wrong version of openssl
- Right way to deploy Rails + Puma + Postgres app to
- AWS S3 in rails - how to set the s3_signature_vers
- Difference between Thread#run and Thread#wakeup?
- how to call a active record named scope with a str
- How to add a JSON column in MySQL with Rails 5 Mig
- “No explicit conversion of Symbol into String” for
- form_for wrong number of arguments in rails 4
I'm not sure if there's another gem available besides
ActiveSupport
, but it would be really straight-forward to make a small version yourself:from_now
can be implemented likeago
but with+ self
andweeks
,hours
etc. likedays
using different constants.I found: https://github.com/kylewlacy/timerizer
ActiveSupport has this functionality. It was originally part of Rails but can now be used separately.