From d94ff3d36be32f7fa386d4578fe43cca088c7b3d Mon Sep 17 00:00:00 2001 From: Stawberri Date: Sat, 6 Dec 2014 23:31:58 -0800 Subject: [PATCH] Better optional parameter integration Apparently I'm dumb and didn't know about equal signs in parameters. --- lib/twitter_ebooks/bot.rb | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/lib/twitter_ebooks/bot.rb b/lib/twitter_ebooks/bot.rb index 1455d5e..24a7ce0 100644 --- a/lib/twitter_ebooks/bot.rb +++ b/lib/twitter_ebooks/bot.rb @@ -109,21 +109,18 @@ module Ebooks # Get an array of media uris in tweet. # @param size [String] A twitter image size to return. Supported sizes are thumb, small, medium (default), large # @return [Array] image URIs included in tweet - def media_uris(*args) - # When there's no size given, the default is medium. - size = '' - # Was one given? - unless args.empty? - case args[0] - when 'thumb' - size = ':thumb' - when 'small' - size = ':small' - when 'medium' - size = ':medium' - when 'large' - size = ':large' - end + def media_uris(size_input = '') + case size_input + when 'thumb' + size = ':thumb' + when 'small' + size = ':small' + when 'medium' + size = ':medium' + when 'large' + size = ':large' + else + size = '' end # Start collecting uris.