Permalink
Browse files

Refactoring the boilerplate code

  • Loading branch information...
1 parent 3299fb7 commit 15f27d857b71b550e31eb6d4c92f1df82b6d46a3 @edmore committed May 25, 2012
Showing with 6 additions and 6 deletions.
  1. +5 −5 peekaboo.rb
  2. +1 −1 views/start.haml
View
@@ -32,14 +32,14 @@
get "/start" do
length = redis.llen("questions")
- all_text = []
- all_filenames = []
+ text = []
+ filenames = []
(length).times do
question_id = redis.lpop("questions")
- all_text << redis.get("question:#{question_id}:text")
- all_filenames << redis.get("question:#{question_id}:filename")
+ text << redis.get("question:#{question_id}:text")
+ filenames << redis.get("question:#{question_id}:filename")
end
- player_files = all_text.zip(all_filenames)
+ player_files = text.zip(filenames)
haml :start, :locals => {:player_files => player_files}
end
View
@@ -1,2 +1,2 @@
:javascript
- var player_files = #{player_files};
+ var files = #{files};

0 comments on commit 15f27d8

Please sign in to comment.