Sha256: 489aee5d7136284dda2eea04b0ae7f8615b37bcdb68f68125a37aba755d30b07

Contents?: true

Size: 508 Bytes

Versions: 4

Compression:

Stored size: 508 Bytes

Contents

# --- Fix Chronic - can't parse '12th Jan' --- #
begin
  require 'chronic'

  module Chronic

    class << self
      def parse_with_hobo_fix(s)
        parse_without_hobo_fix(if s =~ /^\s*\d+\s*(st|nd|rd|th)\s+[a-zA-Z]+(\s+\d+)?\s*$/
                                 s.sub(/\s*\d+(st|nd|rd|th)/) {|s| s[0..-3]}
                               else
                                 s
                               end)
      end
      alias_method_chain :parse, :hobo_fix
    end
  end
rescue LoadError; end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hobosupport-0.8 lib/hobosupport/fixes/chronic.rb
hobosupport-0.8.1 lib/hobosupport/fixes/chronic.rb
hobosupport-0.8.2 lib/hobosupport/fixes/chronic.rb
hobosupport-0.8.3 lib/hobosupport/fixes/chronic.rb