class Para::SeoTools::MetaTags::Tags::Image

Public Class Methods

process(value) click to toggle source
# File lib/para/seo_tools/meta_tags/tags/image.rb, line 10
def self.process(value)
  url = url_from(value)

  if url.start_with?('http://')
    url
  else
    if (request = RequestStore.store[:'para.seo_tools.request'])
      URI.join(request.url, url).to_s
    else
      url
    end
  end
end

Private Class Methods

url_from(value) click to toggle source
# File lib/para/seo_tools/meta_tags/tags/image.rb, line 38
def self.url_from(value)
  if Paperclip::Attachment === value
    value.url(:thumb)
  else
    value.to_s
  end
end

Public Instance Methods

value() click to toggle source
# File lib/para/seo_tools/meta_tags/tags/image.rb, line 6
def value
  self.class.process(instance_image)
end

Private Instance Methods

instance_image() click to toggle source
# File lib/para/seo_tools/meta_tags/tags/image.rb, line 26
def instance_image
  if member_action?
    Para::SeoTools.image_methods.each do |method|
      if instance.respond_to?(method) && instance.send(method)
        return instance.send(method).url
      end
    end

    nil
  end
end