Class: MSR::Tracks

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

Constructor Details

#initializeObject

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.

Returns:

  • (Boolean)

    true if the two are equal, false otherwise



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

#reverseMSR::Tracks

Reverse the direction of the tracks, returning a new object.

Returns:



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.

Returns:



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

#track1MSR::Track

The first track on the card.

Returns:



7
# File 'ext/msr/tracks.c', line 7

static VALUE msr_tracks_track1(VALUE self);

#track2MSR::Track

The second track on the card.

Returns:



13
# File 'ext/msr/tracks.c', line 13

static VALUE msr_tracks_track2(VALUE self);

#track3MSR::Track

The third track on the card.

Returns:



19
# File 'ext/msr/tracks.c', line 19

static VALUE msr_tracks_track3(VALUE self);