Sha256: e3cf9c60b3cf88c2e8fc8ec5d423c72805252a0c803c1dc1dd226654acf99ce2

Contents?: true

Size: 999 Bytes

Versions: 10

Compression:

Stored size: 999 Bytes

Contents

module RD

  VERSION = '0.6.38'

  class Version
    attr_reader :name
    attr_reader :major, :minor, :patch_level

    def Version.new_from_version_string(name, version_str)
      major, minor, patch_level, *dummy = analyze_version_string(version_str)
      return Version.new(name, major, minor, patch_level)
    end
    
    def initialize(name, major, minor, patch_level)
      @name = name
      @major = major
      @minor = minor
      @patch_level = patch_level
    end

    def Version.analyze_version_string(version_str)
      version_str = clean_up_version_string(version_str)
      version_str.split(/\./).collect{|i| i.to_i }
    end

    def to_s
      result = sprintf("%s %d", @name, @major)
      result += sprintf(".%d", @minor) if @minor
      result += sprintf(".%d", @patch_level) if @patch_level
      result
    end

    def Version.clean_up_version_string(version_str)
      if /^\$Version:?\s*(.*)\$/ === version_str
	$1
      else
	version_str
      end
    end
  end
end

Version data entries

10 entries across 9 versions & 2 rubygems

Version Path
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/rdtool-0.6.38/lib/rd/version.rb
tdiary-5.0.8 vendor/bundle/gems/rdtool-0.6.38/lib/rd/version.rb
tdiary-5.0.5 vendor/bundle/gems/rdtool-0.6.38/lib/rd/version.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/rdtool-0.6.38/lib/rd/version.rb
tdiary-5.0.4 vendor/bundle/gems/rdtool-0.6.38/lib/rd/version.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/rdtool-0.6.38/lib/rd/version.rb
tdiary-3.2.2.20130518 vendor/rdtool-0.6.38/lib/rd/version.rb
tdiary-3.2.2.20130508 vendor/rdtool-0.6.38/lib/rd/version.rb
tdiary-3.2.2.20130507 vendor/rdtool-0.6.38/lib/rd/version.rb
rdtool-0.6.38 lib/rd/version.rb