add Runtime.read
This commit is contained in:
parent
41855c4e89
commit
2ae76e55f1
@ -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.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user