Sha256: c7b148574845b0d9b133a3956735a81d786239892cd2918943553ddb04b05f5d

Contents?: true

Size: 492 Bytes

Versions: 20

Compression:

Stored size: 492 Bytes

Contents

require 'date'

begin
  d = ::Date.today
  d.freeze
  d.year
  needs_patch = false
rescue => e
  needs_patch = true
end

if needs_patch
 
  class ::Date

    [ :amjd, :jd, :day_fraction, :mjd, :ld, :civil, :ordinal, :commercial, :weeknum0, :weeknum1, :time, :wday, :julian?, :gregorian?, :leap? ].each do |m|
      module_eval <<EOS
        alias_method :__orig_#{m}, :#{m}
        def #{m}
          self.frozen? ? self.dup.#{m} : self.send(:__orig_#{m})
        end
EOS
    end

  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
nanoc-3.6.7 lib/nanoc/base/core_ext/date.rb
nanoc-3.6.6 lib/nanoc/base/core_ext/date.rb
nanoc-3.6.5 lib/nanoc/base/core_ext/date.rb
nanoc-3.6.4 lib/nanoc/base/core_ext/date.rb
nanoc-3.6.3 lib/nanoc/base/core_ext/date.rb
nanoc-3.6.2 lib/nanoc/base/core_ext/date.rb
nanoc-3.6.1 lib/nanoc/base/core_ext/date.rb
nanoc-3.6.0 lib/nanoc/base/core_ext/date.rb
nanoc-3.5.0 lib/nanoc/base/core_ext/date.rb
nanoc-3.5.0b2 lib/nanoc/base/core_ext/date.rb
nanoc-3.5.0b1 lib/nanoc/base/core_ext/date.rb
nanoc-3.4.3 lib/nanoc/base/core_ext/date.rb
nanoc-3.4.2 lib/nanoc/base/core_ext/date.rb
nanoc-3.4.1 lib/nanoc/base/core_ext/date.rb
nanoc-3.4.0 lib/nanoc/base/core_ext/date.rb
nanoc-3.3.7 lib/nanoc/base/core_ext/date.rb
nanoc-3.3.6 lib/nanoc/base/core_ext/date.rb
nanoc-3.3.5 lib/nanoc/base/core_ext/date.rb
nanoc-3.3.4 lib/nanoc/base/core_ext/date.rb
nanoc-3.3.3 lib/nanoc/base/core_ext/date.rb