Created
February 15, 2013 20:56
-
-
Save jeremyolliver/4963475 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
def self.coerce_rlimit_resource(resource) | |
if resource.is_a?(Symbol) && (const_name = "RLIMIT_#{resource}") && const_defined?(const_name) | |
resource = const_get(const_name) | |
else | |
raise ArgumentError, "invalid resource name #{resource}" | |
end | |
Rubinius::Type.coerce_to resource, Integer, :to_int | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ah, I see. Yeah, I guess that's a little more concise than initial implementation