Sha256: 143203c4e338c1c1f004ba2c2ef8a94075ece9193d9162597e6af4673a52ae9b

Contents?: true

Size: 470 Bytes

Versions: 3

Compression:

Stored size: 470 Bytes

Contents

# frozen_string_literal: true

module INat::App::Config::ShiftAge

  class << self

    def parse source
      source = source.to_i if /\d+/ === source
      source = source.to_s.downcase.intern if Symbol === source || String === source
      case source
      when nil
        0
      when Integer
        source
      when :daily, :weekly, :monthly
        source
      else
        raise TypeError, "Invalid shift age value: #{source}!"
      end
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
inat-get-0.8.0.15 lib/inat/app/config/shiftage.rb
inat-get-0.8.0.14 lib/inat/app/config/shiftage.rb
inat-get-0.8.0.13 lib/inat/app/config/shiftage.rb