Skip to content

Instantly share code, notes, and snippets.

@Beyarz
Created July 15, 2022 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Beyarz/1c80b144362dcd0b1cf7c679614ac5da to your computer and use it in GitHub Desktop.
Save Beyarz/1c80b144362dcd0b1cf7c679614ac5da to your computer and use it in GitHub Desktop.
Get all images from directory
pictures = Proc.new { |file| file.match(/(png|jpeg|jpg)/) }
Dir.entries('.').select &pictures
=> ["image1.png", "image2.png", "pic.jpg", "picture.jpeg"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment