Skip to content

Commit

Permalink
Eliminate a warning when calling File.open with keyword arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
philr committed Dec 23, 2019
1 parent 3d4c491 commit 54fce8c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/tzinfo/ruby_core_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,19 @@ def self.force_encoding(str, encoding)
def self.open_file(file_name, mode, opts, &block)
File.open(file_name, mode, &block)
end
else
elsif RUBY_VERSION =~ /\A1\.9\./
def self.open_file(file_name, mode, opts, &block)
File.open(file_name, mode, opts, &block)
end
else
# Evaluate method as a string because **opts isn't valid syntax prior to
# Ruby 2.0.
eval(<<-EOF
def self.open_file(file_name, mode, opts, &block)
File.open(file_name, mode, **opts, &block)
end
EOF
)
end


Expand Down

0 comments on commit 54fce8c

Please sign in to comment.