Skip to content

Commit 455cd47

Browse files
authored
Make binary_wrapper compatible with Ruby 2.3
This commit applies the suggestions from #63 (comment)
1 parent a471a56 commit 455cd47

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ruby/private/binary_wrapper.tpl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ require 'rbconfig'
2222

2323
# Ruby 2.4 and older does not have +.children+
2424
# So we define it.
25-
unless Dir.respond_to?(:children)
26-
Dir.define_method :children do |dir|
27-
Dir.entries(dir).reject { |entry| %w(. ..).include?(entry) }
28-
end
25+
unless Dir.respond_to?(:children)
26+
Dir.class.send :define_method, :children do |dir|
27+
Dir.entries(dir).reject { |entry| %w(. ..).include?(entry) }
28+
end
2929
end
3030

3131
def find_runfiles
@@ -52,7 +52,8 @@ def create_loadpath_entries(custom, runfiles)
5252
end
5353

5454
def get_repository_imports(runfiles)
55-
Dir.children(runfiles).map {|d|
55+
children = Dir.entries(runfiles) - [".", ".."]
56+
children.map {|d|
5657
File.join(runfiles, d)
5758
}.select {|d|
5859
File.directory? d

0 commit comments

Comments
 (0)