Class: MSR::Tracks
- Inherits:
-
Object
- Object
- MSR::Tracks
- Defined in:
- lib/msr/tracks.rb,
ext/msr/tracks.c
Overview
Represents (up to) three tracks from a magnetic stripe card.
Instance Method Summary collapse
-
#==(o) ⇒ Boolean
Compare two sets of tracks for equality.
- #initialize ⇒ Object constructor
-
#reverse ⇒ MSR::Tracks
Reverse the direction of the tracks, returning a new object.
-
#reverse! ⇒ MSR::Tracks
Reverse the direction of the tracks, in place.
-
#track1 ⇒ MSR::Track
The first track on the card.
-
#track2 ⇒ MSR::Track
The second track on the card.
-
#track3 ⇒ MSR::Track
The third track on the card.
Constructor Details
#initialize ⇒ Object
Instance Method Details
#==(o) ⇒ Boolean
Compare two sets of tracks for equality. Two sets are said to be equal if all of their corresponding pairs are equal.
19 20 21 22 |
# File 'lib/msr/tracks.rb', line 19 def ==(o) return unless o.is_a?(self.class) track1 == o.track1 && track2 == o.track2 && track3 == o.track3 end |
#reverse ⇒ MSR::Tracks
Reverse the direction of the tracks, returning a new object.
25 |
# File 'ext/msr/tracks.c', line 25 static VALUE msr_tracks_reverse(VALUE self); |
#reverse! ⇒ MSR::Tracks
Reverse the direction of the tracks, in place.
6 7 8 9 10 11 12 13 14 |
# File 'lib/msr/tracks.rb', line 6 def reverse! reversed = self.reverse @track1 = reversed.track1 @track2 = reversed.track2 @track3 = reversed.track3 self # return ourself, just for convenience end |
#track1 ⇒ MSR::Track
The first track on the card.
7 |
# File 'ext/msr/tracks.c', line 7 static VALUE msr_tracks_track1(VALUE self); |
#track2 ⇒ MSR::Track
The second track on the card.
13 |
# File 'ext/msr/tracks.c', line 13 static VALUE msr_tracks_track2(VALUE self); |
#track3 ⇒ MSR::Track
The third track on the card.
19 |
# File 'ext/msr/tracks.c', line 19 static VALUE msr_tracks_track3(VALUE self); |