D
Daniel Waite
Hi. Consider the ruby-hmac gem:
http://pastie.org/580360
Line 81 makes the following call:
hmac = self.new(key)
But, insofar as I understand Ruby's wonderful world context switching,
self, in the instance in which it is called, is both unnecessary
(because the method in which it is being called is already part of the
class) and incorrect (because the only initialize method available
requires more than one argument).
The file works (in some instances...), so I'll assume my understanding
of Ruby is still poor. Which sucks because I thought I knew it fairly
well.
I've tried printing out self in each new context, and I get the expected
result (HMAC::Base). Except, that is, inside a Rails application running
on Ruby 1.9.1, in which case I get HMAC::SHA1 within the Base.digest
method. Awesome.
Any ideas?
http://pastie.org/580360
Line 81 makes the following call:
hmac = self.new(key)
But, insofar as I understand Ruby's wonderful world context switching,
self, in the instance in which it is called, is both unnecessary
(because the method in which it is being called is already part of the
class) and incorrect (because the only initialize method available
requires more than one argument).
The file works (in some instances...), so I'll assume my understanding
of Ruby is still poor. Which sucks because I thought I knew it fairly
well.
I've tried printing out self in each new context, and I get the expected
result (HMAC::Base). Except, that is, inside a Rails application running
on Ruby 1.9.1, in which case I get HMAC::SHA1 within the Base.digest
method. Awesome.
Any ideas?