Class: ZBar::LibraryVersion
- Inherits:
-
Object
- Object
- ZBar::LibraryVersion
- Includes:
- Comparable
- Defined in:
- lib/zbar/library_version.rb
Overview
Represents a version of the ZBar library, e.g. as returned by ZBar.library_version.
Instance Attribute Summary collapse
-
#major ⇒ Object
readonly
Major version number.
-
#minor ⇒ Object
readonly
Minor version number.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Compare this version to another LibraryVersion.
-
#initialize(major, minor) ⇒ LibraryVersion
constructor
:nodoc:.
-
#to_s ⇒ Object
Format the library version as a string.
Constructor Details
#initialize(major, minor) ⇒ LibraryVersion
:nodoc:
19 20 21 |
# File 'lib/zbar/library_version.rb', line 19 def initialize(major, minor) #:nodoc: @major, @minor = major, minor end |
Instance Attribute Details
#major ⇒ Object (readonly)
Major version number
24 25 26 |
# File 'lib/zbar/library_version.rb', line 24 def major @major end |
#minor ⇒ Object (readonly)
Minor version number
27 28 29 |
# File 'lib/zbar/library_version.rb', line 27 def minor @minor end |
Instance Method Details
#<=>(other) ⇒ Object
Compare this version to another LibraryVersion
30 31 32 |
# File 'lib/zbar/library_version.rb', line 30 def <=>(other) [major, minor] <=> [other.major, other.minor] end |
#to_s ⇒ Object
Format the library version as a string
37 38 39 |
# File 'lib/zbar/library_version.rb', line 37 def to_s "#{major}.#{minor}" end |