class MongoDB::Version
Constants
- VERSION
Attributes
major[R]
minor[R]
patch[R]
special[R]
version[R]
Public Class Methods
[](version)
click to toggle source
# File lib/mongodb/version.rb, line 19 def self.[](version) version.is_a?(Version) ? version : self.new(version) end
new(version)
click to toggle source
# File lib/mongodb/version.rb, line 8 def initialize(version) raise "Nil versions are useless to me" if version.nil? @major, @minor, @patch, @special = version.match(/^([\d]+)\.([\d]+)\.([\d]+)(?:\-(.+))?$/).to_a[1..-1] @version = version @major = @major.to_i @minor = @minor.to_i @patch = @patch.to_i end
Public Instance Methods
<(other)
click to toggle source
# File lib/mongodb/version.rb, line 27 def <(other) compare([:<, :<, :<], other) end
<=(other)
click to toggle source
# File lib/mongodb/version.rb, line 35 def <=(other) compare([:<, :<, :<=], other) end
==(other)
click to toggle source
# File lib/mongodb/version.rb, line 39 def ==(other) other = MongoDB::Version[other] major == other.major && minor == other.minor && patch == other.patch end
===(other)
click to toggle source
# File lib/mongodb/version.rb, line 44 def ===(other) self == other && special == Version[other].special end
>(other)
click to toggle source
# File lib/mongodb/version.rb, line 23 def >(other) compare([:>, :>, :>], other) end
>=(other)
click to toggle source
# File lib/mongodb/version.rb, line 31 def >=(other) compare([:>, :>, :>=], other) end
authentication_schemes()
click to toggle source
# File lib/mongodb/version.rb, line 62 def authentication_schemes case when self < "2.4.0" then [1] when self >= "2.4.0" && self < "2.6.0" then [1, 2] when self >= "2.6.0" then [2] end end
compare(operators, other)
click to toggle source
# File lib/mongodb/version.rb, line 48 def compare(operators, other) other = Version[other] unless other.is_a?(Version) major.send(operators.shift, other.major) || # Major match method? ((major == other.major) && # Major equal and further comparison? minor.send(operators.shift, other.minor) || # Minor match method? ((minor == other.minor) && # Minor equal and further comparison? patch.send(operators.shift, other.patch))) # Patch match method? end
text_search()
click to toggle source
# File lib/mongodb/version.rb, line 70 def text_search case when self >= "2.4.0" && self < "2.6.0" then :beta when self >= "2.6.0" then :production end end
text_search?()
click to toggle source
# File lib/mongodb/version.rb, line 77 def text_search? !!text_search end
ttl_collections?()
click to toggle source
# File lib/mongodb/version.rb, line 58 def ttl_collections? self >= "2.2.0" end