method

valid_date_frags?

Importance_0
v1_8_6_287 - Show latest stable - 0 notes - Class: Date
valid_date_frags?(elem, sg) private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/date.rb, line 860
  def self.valid_date_frags?(elem, sg) # :nodoc:
    catch :jd do
      a = elem.values_at(:jd)
      if a.all?
        if jd = valid_jd?(*(a << sg))
          throw :jd, jd
        end
      end

      a = elem.values_at(:year, :yday)
      if a.all?
        if jd = valid_ordinal?(*(a << sg))
          throw :jd, jd
        end
      end

      a = elem.values_at(:year, :mon, :mday)
      if a.all?
        if jd = valid_civil?(*(a << sg))
          throw :jd, jd
        end
      end

      a = elem.values_at(:cwyear, :cweek, :cwday)
      if a[2].nil? && elem[:wday]
        a[2] = elem[:wday].nonzero? || 7
      end
      if a.all?
        if jd = valid_commercial?(*(a << sg))
          throw :jd, jd
        end
      end

      a = elem.values_at(:year, :wnum0, :wday)
      if a[2].nil? && elem[:cwday]
        a[2] = elem[:cwday] % 7
      end
      if a.all?
        if jd = valid_weeknum?(*(a << 0 << sg))
          throw :jd, jd
        end
      end

      a = elem.values_at(:year, :wnum1, :wday)
      if a[2]
        a[2] = (a[2] - 1) % 7
      end
      if a[2].nil? && elem[:cwday]
        a[2] = (elem[:cwday] - 1) % 7
      end
      if a.all?
        if jd = valid_weeknum?(*(a << 1 << sg))
          throw :jd, jd
        end
      end
    end
  end
Register or log in to add new notes.