Skip to content

Instantly share code, notes, and snippets.

@pixeltrix
Forked from lazyatom/gist:217001
Created October 23, 2009 17:42
Show Gist options
  • Save pixeltrix/217074 to your computer and use it in GitHub Desktop.
Save pixeltrix/217074 to your computer and use it in GitHub Desktop.
# This works
require 'rubygems'
require 'activesupport'
class Base
def self.cry
"#{self.name}.cry called!"
end
end
module Behaviour
def blame
puts self.class.parent.const_get(:Child).cry
end
end
module Parent
class Child < Base
end
class Sibling < Base
include Behaviour
end
end
sibling = Parent::Sibling.new
sibling.blame # NameError here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment