class SeoSensei::Resource

Public Class Methods

new(translation, obj, url) click to toggle source
# File lib/seo_sensei/resource.rb, line 3
def initialize(translation, obj, url)
  @translation = translation
  @obj = obj
  @url = url
end

Public Instance Methods

description() click to toggle source
# File lib/seo_sensei/resource.rb, line 17
def description
  @translation[:description]
end
keywords() click to toggle source
# File lib/seo_sensei/resource.rb, line 21
def keywords
  @translation[:keywords]
end
seo_image_height() click to toggle source
# File lib/seo_sensei/resource.rb, line 45
def seo_image_height
  if use_obj_image?
    @obj.seo_image_dimensions[:height].to_s
  elsif use_translation_image?
    @translation[:seo_image_height]
  end
end
seo_image_url() click to toggle source
# File lib/seo_sensei/resource.rb, line 29
def seo_image_url
  if use_obj_image?
    @obj.seo_image_url
  elsif use_translation_image?
    @translation[:seo_image_url]
  end
end
seo_image_width() click to toggle source
# File lib/seo_sensei/resource.rb, line 37
def seo_image_width
  if use_obj_image?
    @obj.seo_image_dimensions[:width].to_s
  elsif use_translation_image?
    @translation[:seo_image_width]
  end
end
title() click to toggle source
# File lib/seo_sensei/resource.rb, line 13
def title
  @translation[:title]
end
url() click to toggle source
# File lib/seo_sensei/resource.rb, line 9
def url
  @url
end
use_image?() click to toggle source
# File lib/seo_sensei/resource.rb, line 25
def use_image?
  use_obj_image? || use_translation_image?
end

Private Instance Methods

use_obj_image?() click to toggle source
# File lib/seo_sensei/resource.rb, line 55
def use_obj_image?
  !@obj.nil? &&
    @obj.respond_to?(:use_seo_image?) &&
    @obj.use_seo_image?
end
use_translation_image?() click to toggle source
# File lib/seo_sensei/resource.rb, line 61
def use_translation_image?
  !@translation[:seo_image_url].nil? &&
    !@translation[:seo_image_width].nil? &&
    !@translation[:seo_image_height].nil?
end