/usr/lib/ruby/1.8/rd/version.rb is in librd-ruby1.8 0.6.22-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | module RD
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
|