Skip to content

Instantly share code, notes, and snippets.

@bricker
Created September 13, 2012 23:49
Show Gist options
  • Save bricker/3718692 to your computer and use it in GitHub Desktop.
Save bricker/3718692 to your computer and use it in GitHub Desktop.
module Concern
def modname
self.name
end
end
module Validation
extend Concern
module EventValidation; end
end
def show_modname(mod)
mod.modname rescue "modname undefined for #{mod}"
end
puts show_modname(Validation) #=> "Validation"
puts show_modname(Validation::EventValidation) #=> "modname undefined for EventValidation"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment