Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update forEach calls to be comprehensions

  • Loading branch information...
commit 56a1115a2bd5152df37abf8e67fa8e1ec8566772 1 parent a4a6d50
Tom Bell authored
View
14 src/creator.coffee
@@ -36,7 +36,7 @@ class Creator
#
# path - The destination
copyDefaultScripts: (path) ->
- Fs.readdirSync(@scriptsDir).forEach (file) =>
+ for file in Fs.readdirSync(@scriptsDir)
@copy "#{@scriptsDir}/#{file}", "#{path}/#{file}"
# Run the creator process
@@ -52,7 +52,15 @@ class Creator
@copyDefaultScripts("#{@path}/scripts")
- ["Procfile", "package.json", "README.md", ".gitignore", "bin/hubot", "hubot-scripts.json"].forEach (file) =>
- @copy "#{@templateDir}/#{file}", "#{@path}/#{file}"
+ files = [
+ "Procfile",
+ "package.json",
+ "README.md",
+ ".gitignore",
+ "bin/hubot",
+ "hubot-scripts.json"
+ ]
+
+ @copy "#{@templateDir}/#{file}", "#{@path}/#{file}" for file in files
exports.Creator = Creator
View
2  src/hubot/campfire.coffee
@@ -39,7 +39,7 @@ class Campfire extends Robot
bot.Me (err, data) ->
bot.info = data.user
bot.name = bot.info.name
- bot.rooms.forEach (room_id) ->
+ for room_id in bot.rooms
bot.Room(room_id).join (err, callback) ->
bot.Room(room_id).listen()
View
4 src/hubot/hipchat.coffee
@@ -5,12 +5,12 @@ Wobot = require("wobot").Bot
class HipChat extends Robot
send: (user, strings...) ->
console.log "Sending"
- strings.forEach (str) =>
+ for str in strings
@bot.message user.reply_to, str
reply: (user, strings...) ->
console.log "Replying"
- strings.forEach (str) =>
+ for str in strings
@send user, "@#{user.name} #{str}"
run: ->
View
2  src/hubot/twilio.coffee
@@ -20,7 +20,7 @@ class Twilio extends Robot
console.log "successful sending #{body}"
reply: (user, strings...) ->
- strings.forEach (str) =>
+ for str in strings
@send user, "#{user.name}: #{str}"
respond: (regex, callback) ->
View
4 src/hubot/xmpp.coffee
@@ -66,7 +66,7 @@ class XmppBot extends Robot
@receive new Robot.TextMessage user, message
send: (user, strings...) ->
- strings.forEach (str) =>
+ for str in strings
console.log "Sending to #{user.room}: #{str}"
to = if user.type in ['direct', 'chat'] then user.room + '/' + user.id else user.room
@@ -81,7 +81,7 @@ class XmppBot extends Robot
@client.send message
reply: (user, strings...) ->
- strings.forEach (str) =>
+ for str in strings
@send user, "#{user.name}: #{str}"
module.exports = XmppBot
View
2  src/robot.coffee
@@ -76,7 +76,7 @@ class Robot
#
# Returns nothing.
receive: (message) ->
- @listeners.forEach (lst) ->
+ for lst in @listeners
try
lst.call message
catch ex
Please sign in to comment.
Something went wrong with that request. Please try again.