Rails 3.1 modules

I think in earlier versions, I put modules into RAILS_ROOT/lib

I have a module that I extracted from activesambaldap to create a
Windows Hash Password that I will need to use on occasion that looks
something like this…

require ‘openssl’

module Samba
module Encrypt
module_function
def lm_hash(password, encoding=nil)
dos_password = Private.convert_encoding(“ISO-8859-1”,
encoding || “UTF-8”,
password.upcase)
if dos_password.size > 14
warn(“password is truncated to 14 characters”)
dos_password = dos_password[0, 14]
end
Private.encrypt_14characters(dos_password).unpack(“C*”).collect do
|char|
“%02X” % char
end.join
end

Can I just drop it in ‘RAILS_ROOT’ lib and require it when I need it?


Craig W. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[email protected]
1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Need help communicating between generations at work to achieve your
desired success? Let us help!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs