Class: BugGuard

Inherits:
VersionGuard show all
Defined in:
lib/mspec/guards/bug.rb

Instance Method Summary collapse

Methods inherited from VersionGuard

#ruby_version

Methods inherited from SpecGuard

#===, #after, #before, finish, #implementation?, #os?, #platform?, register, #unregister, unregister, #windows?, #wordsize?, #yield?

Constructor Details

#initialize(bug, version) ⇒ BugGuard

Returns a new instance of BugGuard.



4
5
6
7
# File 'lib/mspec/guards/bug.rb', line 4

def initialize(bug, version)
  @bug = bug
  @version = to_v version
end

Instance Method Details

#match?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/mspec/guards/bug.rb', line 16

def match?
  implementation?(:ruby, :ruby18, :ruby19) && ruby_version <= @version
end

#to_v(str) ⇒ Object



9
10
11
12
13
14
# File 'lib/mspec/guards/bug.rb', line 9

def to_v(str)
  major, minor, tiny, patch = str.split "."
  tiny = 99 unless tiny
  patch = 9999 unless patch
  ("1%02d%02d%02d%04d" % [major, minor, tiny, patch].map { |x| x.to_i }).to_i
end