プロジェクト

全般

プロフィール

バグ #285 » openimg.rb.diff

0.0.3用 #285 修正パッチ - Izumi Tsutsui, 2011-08-24 21:57

差分を表示:

0.0.3/core/addon/openimg.rb
if dom
attribute = {}
catch(:imgtag_match){
dom.each_matches(Regexp.new("<#{tag_name}.*?>")){ |str, pos|
dom.gsub("\n", ' ').each_matches(Regexp.new("<#{tag_name}.*?>")){ |str, pos|
attr = get_tag_by_attributes(str.to_s)
if element_rule.all?{ |k, v| v === attr[k] }
attribute = attr.freeze
throw :imgtag_match end } }
unless attribute.empty?
return attr_name ? attribute[attr_name.to_s] : attribute end end
notice 'not match'
nil end
def self.imgurlresolver(url, element_rule, &block)
......
res = Net::HTTP.new(uri.host).get(uri.path, "User-Agent" => Environment::NAME + '/' + Environment::VERSION.to_s)
if(res.is_a?(Net::HTTPResponse)) and (res.code == '200')
result = get_tagattr(res.body, element_rule)
notice result
notice result.inspect
result
else
warn "#{res.code} failed"
    (1-1/1)