Skip to content

Instantly share code, notes, and snippets.

@jeremyolliver
Created February 15, 2013 20:56
Show Gist options
  • Save jeremyolliver/4963475 to your computer and use it in GitHub Desktop.
Save jeremyolliver/4963475 to your computer and use it in GitHub Desktop.
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
@jeremyolliver
Copy link
Author

Ah, I see. Yeah, I guess that's a little more concise than initial implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment