Skip to content

Instantly share code, notes, and snippets.

@panych
Created February 14, 2014 09:10
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 panych/8998049 to your computer and use it in GitHub Desktop.
Save panych/8998049 to your computer and use it in GitHub Desktop.
File iterator in Rails (usefull when testing autosprites)
.list-group
- Dir.foreach('app/assets/images/ic-a') do |fname|
- next if fname == '.' || fname == '..' || !fname.include?('.')
- fname_without_ext = fname[/.*(?=\..+$)/]
li.list-group-item
p .ic-a.ic-a_#{fname_without_ext}
i( class="ic-a ic-a_#{fname_without_ext}" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment