[Resolved] Setting Source Rectangle

I'm having a bit of trouble with setting the source rectangle for a sprite I'm having. The sprite itself is split up in 4x4 frames just as the normal character sets, and the "@step" variable is equal to either 0, 1, 2 or 3. I have debugged it to make sure that this variable never exceeds 3 or goes below 0, and it does not.
  1.  #--------------------------------------------------------------------------
  2.   # * Set Graphic
  3.   #--------------------------------------------------------------------------
  4.   def set_graphic
  5.     return unless self.visible
  6.     # Obtain width and height of frames
  7.     width   = self.bitmap.width / 4
  8.     height  = self.bitmap.height / 4
  9.     self.ox = width / 2
  10.     self.oy = height
  11.     # Direction case
  12.     case @dir
  13.     when Left
  14.       self.src_rect.set(@step * width,0,width,height)
  15.     when Right
  16.       self.src_rect.set(@step * width,height,width,height)
  17.     when Jump
  18.       self.src_rect.set(@step * width,height*2,width,height)
  19.     end
  20.   end
Expand to see the code.

If I do not set a source rectangle with the code, it shows the sprite perfectly fine, but the whole portion of it. I don't know what I'm doing wrong. Might be just something extremely simple that I just can't pinpoint. I have also tried to remove the ox and oy value changes, but all in all I don't see how that'd be a logical fix, anyhow.

Any ideas?

Thanks in advance.
If this class is not inheriting method from the hidden Sprite class, I recommend that, instead of using self.src_rect, you actually set the src_rect on the sprite. If it is inheriting from the Sprite class this should theoretically work. Also, have you print-tested to see if this method is being called? And if it is, have you tried placing a print test inside one or more of the case statements, to see if they ever evaluate as true?
Also, I might be wrong but I think the ox and oy should not change. You don't need to change these values when changing the source rect.
Try removing these 2 lines.
@Glitchfinder: It inherits RPG::Sprite, and yes, I did state that removing everything inside the method would cause the whole graphic to appear (without being cut the way I want it), so the method basically makes my whole sprite invisible for no apparent reason.

@Dargor: Also I stated in my first post that I tried doing this without the ox and oy lines, to no effect.

EDIT: I fixed the problem. It seemed to be a problem with where I created an instance of the class. No idea why, though. Either way, problem is solved. Thanks.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=71086