Created
June 13, 2012 11:00
-
-
Save anonymous/2923435 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/home/user1/.rvm/rubies/ruby-1.9.3-p194/bin/ruby | |
require 'hola/translator' | |
module Hola | |
def hi(language = :english) | |
translator = Translator.new(language) | |
translator.hi | |
end | |
end | |
include Hola | |
puts Hola::hi(:english) | |
lib/hola/translator.rb=> | |
class Translator | |
def initialize(language) | |
@language = language | |
end | |
def hi | |
case @language | |
when :spanish | |
"hola mundo" | |
else | |
"hello world" | |
end | |
end | |
end | |
user1@mybox:~/tempgems/mygem/lib$ ruby -Ilib hola.rb | |
/home/user1/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- hola/translator (LoadError) | |
from /home/user1/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' | |
from hola.rb:3:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment