ruby-duration
ruby-duration copied to clipboard
Immutable type that represents some amount of time with accuracy in seconds.
Unless I'm missing something really obvious there seems to be a problem with negative numbers. For example if I instantiate a couple of Duration objects... ``` a = Duration.new(10) =>...
Currently outputting as a string gives you the following: ``` Duration.new(1000).to_s => "#" ``` I'd love to implement a to_s function that would cause durations to output a little more...
Di you plan on implementing miliseconds? I started using this for an ffmpeg video editing project, and a lot can happen in a second on film. Ffmpeg has a function...
``` ./vendor/bundler/ruby/2.2.0/gems/i18n-0.7.0/lib/i18n.rb:284:in `enforce_available_locales!': :en is not a valid locale (I18n::InvalidLocale) from ./vendor/bundler/ruby/2.2.0/gems/i18n-0.7.0/lib/i18n.rb:151:in `translate' from ./vendor/bundler/ruby/2.2.0/gems/ruby-duration-3.2.2/lib/duration.rb:247:in `i18n_for' from ./vendor/bundler/ruby/2.2.0/gems/ruby-duration-3.2.2/lib/duration.rb:193:in `format' ```
Would be great if one could add a duration to time, yielding a new time instance. `Time.now + Duration.new(:days => 1) #=> time_at_one_day_from_now` Ruby's coerce should also be helpful here,...
Duration has years months, days, hours, minutes, seconds. So why not support all of these? ``` irb(main):004:0> d = Duration.new('P3Y6M4DT12H30M5S') => # irb(main):005:0> d.iso8601 => "P1282DT30M5S" ``` Shouldn't the output...