Skip to content

Instantly share code, notes, and snippets.

@photomattmills
Last active December 11, 2015 10:59
Show Gist options
  • Save photomattmills/4591026 to your computer and use it in GitHub Desktop.
Save photomattmills/4591026 to your computer and use it in GitHub Desktop.
class Dir
def map(&block)
output = []
self.each do |entry|
output << block.call(entry)
end
return output
end
def select(&block)
self.map {|entry| entry if block.call(entry) == true}.compact!
end
end
@photomattmills
Copy link
Author

@JEG2 pointed out that you can do Dir.send(:include, Enumerable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment