-
-
Save apeiros/08e6bec4c04bddb2cbc42407d11adeed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Project = Struct.new(:title, :url) | |
def all(dir) | |
Dir.chdir(dir) do | |
Dir.glob('*').select { |d| File.directory?(d) }.map { |d| | |
Project.new(d, "/project/#{d}") | |
} | |
end | |
end | |
all(project_dir).each do |project| | |
puts "#{project.title} #{project.url}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def title | |
self | |
end | |
def url | |
"/project/#{self}" | |
end | |
def all | |
Dir.chdir(Project_dir) do | |
Dir.glob('*').select { |f| File.directory? f } | |
end | |
end | |
all.each do |project| | |
puts "#{project.title} #{project.url}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment