1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Enclosed version constant

This commit is contained in:
Nobuyoshi Nakada 2020-03-15 22:20:16 +09:00
parent 1ad9b231ca
commit f14409c9bb
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -2,17 +2,19 @@ require_relative '../../spec_helper'
require 'stringio' require 'stringio'
bug_guard = Class.new(VersionGuard) do bug_guard = Class.new(VersionGuard) do
VERSION = StringIO.const_defined?(:VERSION) ? StringIO::VERSION : "0.0.2" self::VERSION = StringIO.const_defined?(:VERSION) ? StringIO::VERSION : "0.0.2"
def initialize(bug, version) def initialize(bug, version)
@bug = bug @bug = bug
super(version) super(version)
@parameters = [bug, version] @parameters = [bug, version]
end end
def match? def match?
version = self.class::VERSION
if Range === @version if Range === @version
@version.include? VERSION @version.include? version
else else
VERSION >= @version version >= @version
end end
end end