Skip to content

Instantly share code, notes, and snippets.

@rondale-sc
Created May 28, 2013 23:57
Show Gist options
  • Save rondale-sc/8d6c676dcf9d824295e1 to your computer and use it in GitHub Desktop.
Save rondale-sc/8d6c676dcf9d824295e1 to your computer and use it in GitHub Desktop.
def visibility
@visibility ||= if owner.public_instance_methods.any? { |m| m.to_s == name }
:public
elsif owner.protected_instance_methods.any? { |m| m.to_s == name }
:protected
elsif owner.private_instance_methods.any? { |m| m.to_s == name }
:private
else
:none
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment