Better optional parameter integration
Apparently I'm dumb and didn't know about equal signs in parameters.
This commit is contained in:
parent
3c54c9a017
commit
d94ff3d36b
1 changed files with 12 additions and 15 deletions
|
@ -109,12 +109,8 @@ module Ebooks
|
||||||
# Get an array of media uris in tweet.
|
# 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
|
# @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
|
# @return [Array<String>] image URIs included in tweet
|
||||||
def media_uris(*args)
|
def media_uris(size_input = '')
|
||||||
# When there's no size given, the default is medium.
|
case size_input
|
||||||
size = ''
|
|
||||||
# Was one given?
|
|
||||||
unless args.empty?
|
|
||||||
case args[0]
|
|
||||||
when 'thumb'
|
when 'thumb'
|
||||||
size = ':thumb'
|
size = ':thumb'
|
||||||
when 'small'
|
when 'small'
|
||||||
|
@ -123,7 +119,8 @@ module Ebooks
|
||||||
size = ':medium'
|
size = ':medium'
|
||||||
when 'large'
|
when 'large'
|
||||||
size = ':large'
|
size = ':large'
|
||||||
end
|
else
|
||||||
|
size = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
# Start collecting uris.
|
# Start collecting uris.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue