Sha256: 25d3fb875ba924f3fd609a363b8edd402679cef835d83bc24c14640386ee8694

Contents?: true

Size: 465 Bytes

Versions: 9

Compression:

Stored size: 465 Bytes

Contents

# frozen_string_literal: true

module FFakerTW
  module SemVer
    extend ModuleUtils
    extend self

    UPDATE = %w[major minor patch].freeze

    def next(previous_version = '0.0.0')
      major, minor, patch = previous_version.split('.').map(&:to_i)
      case fetch_sample(UPDATE)
      when 'major' then "#{major + 1}.0.0"
      when 'minor' then "#{major}.#{minor + 1}.0"
      when 'patch' then "#{major}.#{minor}.#{patch + 1}"
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ffakerTW-1.8.0 lib/ffakerTW/sem_ver.rb
ffakerTW-1.7.0 lib/ffakerTW/sem_ver.rb
ffakerTW-1.6.0 lib/ffakerTW/sem_ver.rb
ffakerTW-1.5.0 lib/ffakerTW/sem_ver.rb
ffakerTW-1.4.0 lib/ffakerTW/sem_ver.rb
ffakerTW-1.3.0 lib/ffakerTW/sem_ver.rb
ffakerTW-1.2.0 lib/ffakerTW/sem_ver.rb
ffakerTW-1.1.0 lib/ffakerTW/sem_ver.rb
ffakerTW-0.1.0 lib/ffakerTW/sem_ver.rb