Class: Mp3file::ID3v2::Version
- Inherits:
-
Object
- Object
- Mp3file::ID3v2::Version
- Includes:
- Comparable
- Defined in:
- lib/mp3file/id3v2/version.rb
Instance Attribute Summary collapse
-
#vbig ⇒ Object
readonly
Returns the value of attribute vbig.
-
#vmaj ⇒ Object
readonly
Returns the value of attribute vmaj.
-
#vmin ⇒ Object
readonly
Returns the value of attribute vmin.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(vmaj, vmin, vbig = 2) ⇒ Version
constructor
A new instance of Version.
- #inspect ⇒ Object
- #to_byte_string ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(vmaj, vmin, vbig = 2) ⇒ Version
Returns a new instance of Version.
7 8 9 10 11 |
# File 'lib/mp3file/id3v2/version.rb', line 7 def initialize(vmaj, vmin, vbig = 2) @vbig = vbig.to_i @vmaj = vmaj.to_i @vmin = vmin.to_i end |
Instance Attribute Details
#vbig ⇒ Object (readonly)
Returns the value of attribute vbig.
5 6 7 |
# File 'lib/mp3file/id3v2/version.rb', line 5 def vbig @vbig end |
#vmaj ⇒ Object (readonly)
Returns the value of attribute vmaj.
5 6 7 |
# File 'lib/mp3file/id3v2/version.rb', line 5 def vmaj @vmaj end |
#vmin ⇒ Object (readonly)
Returns the value of attribute vmin.
5 6 7 |
# File 'lib/mp3file/id3v2/version.rb', line 5 def vmin @vmin end |
Instance Method Details
#<=>(other) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/mp3file/id3v2/version.rb', line 13 def <=>(other) c = vbig <=> other.vbig return c if c != 0 c = vmaj <=> other.vmaj return c if c != 0 vmin <=> other.vmin end |
#inspect ⇒ Object
31 32 33 34 |
# File 'lib/mp3file/id3v2/version.rb', line 31 def inspect "<%p vbig = %p vmaj = %p vmin = %p>" % [ self.class, @vbig, @vmaj, @vmin ] end |
#to_byte_string ⇒ Object
27 28 29 |
# File 'lib/mp3file/id3v2/version.rb', line 27 def to_byte_string [ vmaj, vmin ].pack("cc") end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/mp3file/id3v2/version.rb', line 23 def to_s "ID3v%d.%d.%d" % [ vbig, vmaj, vmin ] end |