Flowdock
method

valid_date_frags?

Importance_0
Ruby latest stable (v1_9_3_392) - 0 notes - Class: Date

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v1_9_2_180) is shown here.

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 951
  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.