Created
November 11, 2013 22:46
-
-
Save mathrick/7421944 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
require_relative 'Settings' | |
module BadBehaviour | |
class Settings | |
include DefaultSettings | |
extend self # make all methods class methods | |
end | |
end |
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
module BadBehaviour | |
module DefaultSettings | |
def strict | |
false | |
end | |
def verbose | |
false | |
end | |
end | |
end |
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
$ irb | |
irb(main):001:0> require './config' | |
TypeError: wrong argument type Class (expected Module) | |
from /home/mathrick/Dev/bad-behaviour/ruby/config.rb:58:in `extend' | |
from /home/mathrick/Dev/bad-behaviour/ruby/config.rb:58:in `<class:Settings>' | |
from /home/mathrick/Dev/bad-behaviour/ruby/config.rb:4:in `<module:BadBehaviour>' | |
from /home/mathrick/Dev/bad-behaviour/ruby/config.rb:3:in `<top (required)>' | |
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' | |
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' | |
from (irb):1 | |
from /usr/bin/irb:12:in `<main>' | |
irb(main):002:0> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment