1

I currently have a folder with a list of small *.ogg files that I would like to insert into an html.erb page in my /public folder.

The code is within video tags - I want to use Ruby to scan the folder and produce a video snippet for each video it finds in the folder. The code will stay the same between videos, except for the video filename.

The resulting page will be a list of playable videos.

Any advice would be awesome.

1
  • How much programming do you know anyway ? Commented Feb 27, 2011 at 22:41

1 Answer 1

3
# assumes the current dir contains the ogg files
html = ''
Dir.glob("*.ogg") do |file|
  html += "<a href=\"#{file}\" />"
end
puts html
# <a href="a.ogg" /><a href="b.ogg" />
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.