Remove File.read_with_options patch to allow 1.9 and 1.8 to behave the same
This commit is contained in:
parent
f14c9db282
commit
601f89d4d1
|
@ -35,8 +35,8 @@ module Jekyll
|
||||||
# Returns nothing.
|
# Returns nothing.
|
||||||
def read_yaml(base, name, opts = {})
|
def read_yaml(base, name, opts = {})
|
||||||
begin
|
begin
|
||||||
self.content = File.read_with_options(File.join(base, name),
|
self.content = File.read(File.join(base, name),
|
||||||
merged_file_read_opts(opts))
|
merged_file_read_opts(opts))
|
||||||
if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
||||||
self.content = $POSTMATCH
|
self.content = $POSTMATCH
|
||||||
self.data = YAML.safe_load($1)
|
self.data = YAML.safe_load($1)
|
||||||
|
|
|
@ -61,12 +61,3 @@ module Enumerable
|
||||||
any? { |exp| File.fnmatch?(exp, e) }
|
any? { |exp| File.fnmatch?(exp, e) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Ruby 1.8's File.read don't support option.
|
|
||||||
# read_with_options ignore optional parameter for 1.8,
|
|
||||||
# and act as alias for 1.9 or later.
|
|
||||||
class File
|
|
||||||
def self.read_with_options(path, opts = {})
|
|
||||||
self.read(path, opts)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ eos
|
||||||
|
|
||||||
# This method allows to modify the file content by inheriting from the class.
|
# This method allows to modify the file content by inheriting from the class.
|
||||||
def source(file, context)
|
def source(file, context)
|
||||||
File.read_with_options(file, file_read_opts(context))
|
File.read(file, file_read_opts(context))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue