Sha256: 9c869d656a3d1f4244cda4f2e469eab9ecb65ef8794d2f6f7cdc48029b5b89ba

Contents?: true

Size: 378 Bytes

Versions: 4

Compression:

Stored size: 378 Bytes

Contents

module Timewizard
  module Utils
    module Wizardry

      VERSION_REGEX = /((\d+\.)?(\d+\.)?(\*|\d+))(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/

      def self.to_i(stringy)
        stringy.gsub(/\D/, '').to_i || 0
      end

      def self.only_version(stringy)
        VERSION_REGEX.match(stringy).to_s
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
timewizard-0.2.4.pre.alpha.pre.41 lib/timewizard/utils/wizardry.rb
timewizard-0.2.4.pre.alpha.pre.40 lib/timewizard/utils/wizardry.rb
timewizard-0.2.4.pre.alpha.pre.30 lib/timewizard/utils/wizardry.rb
timewizard-0.2.3 lib/timewizard/utils/wizardry.rb