How to require a Ruby gem directly from its path? -
in order work rubyzip installed gems:
gem install --local rubyzip-1.1.7.gem gem install --local zip-zip-0.3.gem in code call gems using require method:
require 'zip/zip' require 'zip/filesystem' i want use require load gems directly location on machine.
i want somthing this:
require 'path_to_my_zip_gem' where path_to_my zip_gem contains gem files
basically, it's because require method loads files name paths listed in $: or $load_path
"if filename not resolve absolute path, searched in directories listed in $load_path ($:)."
if want require gem "local" path require_relative method since can specify path relative requiring file’s path. @ official documentation further details:
http://ruby-doc.org/core-2.2.2/kernel.html#method-i-require_relative
Comments
Post a Comment