Better optional parameter integration

Apparently I'm dumb and didn't know about equal signs in parameters.
This commit is contained in:
Stawberri 2014-12-06 23:31:58 -08:00
parent 3c54c9a017
commit d94ff3d36b

View file

@ -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<String>] 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.