Class: OpenfireAdmin::VersionString
- Inherits:
-
Object
- Object
- OpenfireAdmin::VersionString
- Defined in:
- lib/openfire_admin/version_string.rb
Instance Method Summary collapse
- #<(other) ⇒ Object
- #<=(other) ⇒ Object
- #<=>(othre) ⇒ Object
- #==(other) ⇒ Object
- #>(other) ⇒ Object
- #>=(other) ⇒ Object
-
#initialize(version) ⇒ VersionString
constructor
A new instance of VersionString.
- #to_a ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(version) ⇒ VersionString
Returns a new instance of VersionString.
3 4 5 |
# File 'lib/openfire_admin/version_string.rb', line 3 def initialize(version) @version = version.to_s.strip.split(/\./) end |
Instance Method Details
#<(other) ⇒ Object
12 13 14 |
# File 'lib/openfire_admin/version_string.rb', line 12 def < other (self <=> other) == -1 end |
#<=(other) ⇒ Object
18 19 20 |
# File 'lib/openfire_admin/version_string.rb', line 18 def <= other (self <=> other) <= 0 end |
#<=>(othre) ⇒ Object
6 7 8 |
# File 'lib/openfire_admin/version_string.rb', line 6 def <=>(othre) compare(@version.dup, othre.kind_of?(VersionString) ? othre.to_a.dup : othre.to_s.strip.split(/\./)) end |
#==(other) ⇒ Object
21 22 23 |
# File 'lib/openfire_admin/version_string.rb', line 21 def == other (self <=> other) == 0 end |
#>(other) ⇒ Object
9 10 11 |
# File 'lib/openfire_admin/version_string.rb', line 9 def > other (self <=> other) == 1 end |
#>=(other) ⇒ Object
15 16 17 |
# File 'lib/openfire_admin/version_string.rb', line 15 def >= other (self <=> other) >= 0 end |
#to_a ⇒ Object
27 28 29 |
# File 'lib/openfire_admin/version_string.rb', line 27 def to_a @version end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/openfire_admin/version_string.rb', line 24 def to_s "VersionString(#{@version.join(".")})" end |