Skip to content

Instantly share code, notes, and snippets.

@dpickett
Created October 19, 2008 07:02
Show Gist options
  • Save dpickett/17792 to your computer and use it in GitHub Desktop.
Save dpickett/17792 to your computer and use it in GitHub Desktop.
def get_random_troggle_image(options = {})
image_tag(get_random_troggle_image_path, {:class => "troggle"}.options)
end
def troggle_image_paths
path_prefix = "/images/troggles"
@troll_paths ||= [
"#{path_prefix}/bashful.png",
"#{path_prefix}/helpers.png",
"#{path_prefix}/reggies.png",
"#{path_prefix}/smarties.png",
"#{path_prefix}/workers.png"
]
end
private
def get_random_troggle_image_path
troggle_image_paths[rand(troggle_image_paths.length)]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment