Created
March 10, 2009 03:14
-
-
Save lachlanhardy/76696 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
# So this is in my controller: | |
@items = Dir.glob("views/*/*") | |
# Its contents look like this: | |
# views/controls/actions.haml | |
# views/controls/buttons.haml | |
# views/controls/formForge.haml | |
# views/controls/hide-actions.haml | |
# views/controls/index.haml | |
# views/controls/navigation.haml | |
# views/controls/tree.haml | |
# views/dialogs/browser.haml | |
# views/dialogs/dialogBox.haml | |
# My view contains this: | |
- if @items | |
- @items.each do |item| | |
- name = item.gsub(/views\/.+\/(.+).haml/, '\1') | |
- if name != "index" | |
%p do some stuff | |
# That worked fine until now, when I want to also exclude names that start with 'hide-'. | |
# Suggestions thus far (based on my limited cues) have not worked and looked something like these: | |
[email protected](/hide-.+/).empty? | |
@items.select{|x| !x.match(/hide-.+/)} | |
# And I started with something like | |
unless %w["index", /hide-.+/].include? name | |
# Any of all of my code above is certainly rubbish. Feel free to make suggestions to fix other stuff too ;) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment