Ruby on Rails: Generate HTML for each file in a folder -


i have folder list of small *.ogg files insert html.erb page in /public folder.

the code within video tags - want use ruby scan folder , produce video snippet each video finds in folder. code stay same between videos, except video filename.

the resulting page list of playable videos.

any advice awesome.

# assumes current dir contains ogg files html = '' dir.glob("*.ogg") |file|   html += "<a href=\"#{file}\" />" end puts html # <a href="a.ogg" /><a href="b.ogg" /> 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -