Ryan Lane has submitted this change and it was merged.
Change subject: erb: cast string to array for ruby 1.9
......................................................................
erb: cast string to array for ruby 1.9
In ruby 1.9.x (not in use yet), the strings no more have a map()
methods:
undefined method `map' for "#wikimedia-operations":String
(NoMethodError)
To ensure future compatibility with ruby1.9, we simply cast the list of
channels as an array to make sure the result will always have the map()
method.
With ruby 1.8:
>> "my string".map{ |string| string }
=> ["my string"]
With ruby 1.9 that fails:
>> "my string".map{ |string| string }
=> #<NoMethodError: undefined method `map' for "my string":String>
But casting to an array will make it work:
>> Array( "my string" ).map { |string| string }
=> ["my string"]
>>
Change-Id: I50d37166e17b84018a011a1e64a488cce183feed
---
M templates/ircecho/default.erb
1 file changed, 3 insertions(+), 0 deletions(-)
Approvals:
Ryan Lane: Looks good to me, approved
Hashar: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/templates/ircecho/default.erb b/templates/ircecho/default.erb
index 7b58384..aca00ec 100644
--- a/templates/ircecho/default.erb
+++ b/templates/ircecho/default.erb
@@ -6,6 +6,9 @@
def infile(logs)
# make a list of flattened strings w/ one log each and that log's
channels
logs = logs.map {|log,channels|
+ # ensure channels is an Array, not a bare string
+ channels = Array(channels)
+
# prepend # on channel name if missing
channels = channels.map {|channel| channel.sub(/^#?/,'#') }
--
To view, visit https://gerrit.wikimedia.org/r/54692
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I50d37166e17b84018a011a1e64a488cce183feed
Gerrit-PatchSet: 7
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Jeremyb <[email protected]>
Gerrit-Reviewer: Demon <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Jeremyb <[email protected]>
Gerrit-Reviewer: Lcarr <[email protected]>
Gerrit-Reviewer: Ryan Lane <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits