lib/converters/flickr.rb in convert-0.1.5 vs lib/converters/flickr.rb in convert-0.1.6
- old
+ new
@@ -2,10 +2,10 @@
module Converters
def flickr(string, options = {})
# https://www.flickr.com/photos/fotokunstsusanne/23160248869
- {:maxwidth => nil, :maxheight => nil, :link_options => {}}.merge(options)
+ options = {:maxwidth => nil, :maxheight => nil, :link_options => {}}.merge(options)
@regex = %r{https?://(www\.)?flickr\.com/photos/[^\s<]*}
string.gsub(@regex) do |match|
params = { :url => match, :format => "json" }
[:maxwidth, :maxheight].each{|p| params[p] = options[p] unless options[p].nil? or !options[p] > 0}