Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/ruby
# https://bugzilla.suse.com/show_bug.cgi?id=1132650
# https://github.com/yast/yast-packager/pull/434
def file_properties(filename)
print "."
File.lstat(filename)
end
def interesting?(stat)
print "?"
stat.symlink?
end
filenames = Dir.glob("/usr/lib/*")
all_props = filenames.map { |fn| file_properties(fn) }
int_props = all_props.find_all { |p| interesting?(p) }.to_a
puts "NORMAL"
puts int_props.size
all_props_lazy = filenames.lazy.map { |fn| file_properties(fn) }
int_props_lazy = all_props_lazy.find_all { |p| interesting?(p) }.to_a
puts "LAZY"
puts int_props_lazy.size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.