I’ve tried the following line in ruby script/console
require ‘digest/md5’
Both my Mac (Intel iMac) and my Windows box return “false”… Any ideas
what could be wrong? I was trying to do the RoR Recipe on page 54 of
Chad F.'s new (beta) book.
I’ve tried the following line in ruby script/console
require ‘digest/md5’
Both my Mac (Intel iMac) and my Windows box return “false”… Any ideas
what could be wrong? I was trying to do the RoR Recipe on page 54 of
Chad F.'s new (beta) book.
I had that problem too…I think you could probably just substitute sha1
for md5
I’ve tried the following line in ruby script/console
require ‘digest/md5’
Both my Mac (Intel iMac) and my Windows box return “false”… Any ideas
what could be wrong? I was trying to do the RoR Recipe on page 54 of
Chad F.'s new (beta) book.
and for what it’s worth…I thought that particular recipe was
‘half-baked’ since it offered not even the slightest example of view
code that you could use to make that work and I spent too much time
grappling with it and abandoned it for another time.
$ ruby
p require ‘digest/md5’
-:1: warning: parenthesize argument(s) for future version
p require ‘digest/md5’
-:2: warning: parenthesize argument(s) for future version
true
false
I suppose I should also mention:
$ ruby
require ‘no such file’
-:1:in `require’: no such file to load – no such file (LoadError)
from -:1
ideas
-:2: warning: parenthesize argument(s) for future version
Try
require ‘md5’
It’s in a different directory on one of my systems…
No, you need to read more carefully.
Try:
$ ri require
--------------------------------------------------------- Kernel#require
require(string) => true or false
Ruby tries to load the library named _string_, returning +true+ if
successful. If the filename does not resolve to an absolute path,
it will be searched for in the directories listed in +$:+. If the
file has the extension ``.rb'', it is loaded as a source file; if
the extension is ``.so'', ``.o'', or ``.dll'', or whatever the
default shared library extension is on the current platform, Ruby
loads the shared library as a Ruby extension. Otherwise, Ruby
tries
adding .rb'', .so’‘, and so on to the name. The name of the
loaded feature is added to the array in +$“+. A feature will
not be
loaded if it’s name already appears in +$”+. However, the file
name
is not converted to an absolute path, so that ``+require
‘a’;require ‘./a’+’’ will load +a.rb+ twice.
require "my-library.rb"
require "db-driver"
require returns false if the file is already loaded.
I’ve tried the following line in ruby script/console
require ‘digest/md5’
Both my Mac (Intel iMac) and my Windows box return “false”… Any
ideas
what could be wrong? I was trying to do the RoR Recipe on page 54 of
Chad F.'s new (beta) book.
Nothing is wrong.
$ ruby
p require ‘digest/md5’
-:1: warning: parenthesize argument(s) for future version
p require ‘digest/md5’
-:2: warning: parenthesize argument(s) for future version
true
false