Class: ZBar::LibraryVersion

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#majorObject (readonly)

Major version number



24
25
26
# File 'lib/zbar/library_version.rb', line 24

def major
  @major
end

#minorObject (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_sObject

Format the library version as a string



37
38
39
# File 'lib/zbar/library_version.rb', line 37

def to_s
  "#{major}.#{minor}"
end