Class: VersionGuard
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(version) ⇒ VersionGuard
constructor
A new instance of VersionGuard.
- #match? ⇒ Boolean
- #ruby_version ⇒ Object
Methods inherited from SpecGuard
#===, #after, #before, finish, #implementation?, #os?, #platform?, register, ruby_version, #standard?, unregister, #unregister, windows?, #windows?, #wordsize?, #yield?
Constructor Details
#initialize(version) ⇒ VersionGuard
Returns a new instance of VersionGuard.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/mspec/guards/version.rb', line 5 def initialize(version) case version when String @version = SpecVersion.new version when Range a = SpecVersion.new version.first b = SpecVersion.new version.last @version = version.exclude_end? ? a...b : a..b end end |
Instance Method Details
#match? ⇒ Boolean
20 21 22 23 24 25 26 |
# File 'lib/mspec/guards/version.rb', line 20 def match? if Range === @version @version.include? ruby_version else ruby_version >= @version end end |
#ruby_version ⇒ Object
16 17 18 |
# File 'lib/mspec/guards/version.rb', line 16 def ruby_version @ruby_version ||= SpecVersion.new self.class.ruby_version(:full) end |