Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Refactoring the boilerplate code
  • Loading branch information
edmore committed May 25, 2012
1 parent 3299fb7 commit 15f27d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions peekaboo.rb
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion views/start.haml
@@ -1,2 +1,2 @@
:javascript
var player_files = #{player_files};
var files = #{files};

0 comments on commit 15f27d8

Please sign in to comment.