Sha256: ac7032d5feb761871db5428a6f236fe63a300771dac766982014879a04cfa87d

Contents?: true

Size: 451 Bytes

Versions: 2

Compression:

Stored size: 451 Bytes

Contents

# frozen_string_literal: true

module 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

2 entries across 2 versions & 1 rubygems

Version Path
inat-get-0.8.0.12 lib/inat/app/config/shiftage.rb
inat-get-0.8.0.11 lib/inat/app/config/shiftage.rb