Skip to content

Instantly share code, notes, and snippets.

@chrisseaton
Created July 20, 2015 14:43
Show Gist options
  • Save chrisseaton/14375725320e46bc5978 to your computer and use it in GitHub Desktop.
Save chrisseaton/14375725320e46bc5978 to your computer and use it in GitHub Desktop.
module ModuleSpecs
module A
CONSTANT_A = :a
#OVERRIDE = :a
#def ma(); :a; end
#def self.cma(); :a; end
end
module B
#CONSTANT_B = :b
#OVERRIDE = :b
puts 'about to include...'
include A
#def mb(); :b; end
#def self.cmb(); :b; end
end
#class C
# OVERRIDE = :c
# include B
#end
#module Z
# MODULE_SPEC_TOPLEVEL_CONSTANT = 1
#end
end
p ModuleSpecs::A.constants.include?(:CONSTANT_A)
p ModuleSpecs::B.constants.include?(:CONSTANT_A)
#p ModuleSpecs::B.constants.include?(:CONSTANT_B)
#p ModuleSpecs::C.constants.include?(:CONSTANT_A)
#p ModuleSpecs::C.constants.include?(:CONSTANT_B)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment