Sha256: 82ce44233d05cf1403d58b13ff1dec9a0c9ea4e3527990fdaff70db7a9f16c7a

Contents?: true

Size: 307 Bytes

Versions: 8

Compression:

Stored size: 307 Bytes

Contents

require 'chronic'

module TimeDistribution
  module TimeRefinement
    refine Time do
      def count_forward_to(time)
        if self > time
          (Chronic.parse('11:59:59pm') - self) + (time - Chronic.parse('12:00:00am')) + 1
        else
          time - self
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
time_distribution-2.1.2 lib/time_distribution/time.rb
time_distribution-2.1.1 lib/time_distribution/time.rb
time_distribution-2.1.0 lib/time_distribution/time.rb
time_distribution-2.0.2 lib/time_distribution/time.rb
time_distribution-2.0.1 lib/time_distribution/time.rb
time_distribution-2.0.0 lib/time_distribution/time.rb
time_distribution-1.1.0 lib/time_distribution/time.rb
time_distribution-1.0.0 lib/time_distribution/time.rb