add Runtime.read

This commit is contained in:
Josh Holtrop 2014-07-23 15:17:41 -04:00
parent 41855c4e89
commit 2ae76e55f1

View File

@ -35,6 +35,22 @@ module Runtime
path path
end end
# Find and read a runtime file.
#
# @param type [Symbol]
# Type of runtime file to find. See {#find} for available types.
# @param name [String]
# Name of the runtime file to locate.
#
# @return [String]
# Contents of the runtime file, or +nil+ if not found.
def read(type, name)
path = find(type, name)
if path
File.read(path, mode: "rb")
end
end
private private
# Return the default runtime paths. # Return the default runtime paths.