Module: FacebookSocialPlugins::Helper::OpenGraph

Defined in:
lib/facebook-social_plugins/helper/open_graph.rb

Instance Method Summary collapse

Instance Method Details

#fb_app_id(app_id) ⇒ Object



8
9
10
# File 'lib/facebook-social_plugins/helper/open_graph.rb', line 8

def fb_app_id app_id
	 :meta, '', :property => "fb:app_id", :content => app_id
end

#og_desc(desc) ⇒ Object



24
25
26
# File 'lib/facebook-social_plugins/helper/open_graph.rb', line 24

def og_desc desc
	 :meta, '', :property => "og:description", :content => desc
end

#og_header(name, namespace, &block) ⇒ Object



3
4
5
6
# File 'lib/facebook-social_plugins/helper/open_graph.rb', line 3

def og_header name, namespace, &block
	content = capture(&block)
	 :head, content, :prefix => "og: http://ogp.me/ns# og_#{name}: http://ogp.me/ns/apps/#{namespace}x#"
end

#og_image(href) ⇒ Object



20
21
22
# File 'lib/facebook-social_plugins/helper/open_graph.rb', line 20

def og_image href
	 :meta, '', :property => "og:image", :content => href
end

#og_title(title) ⇒ Object



16
17
18
# File 'lib/facebook-social_plugins/helper/open_graph.rb', line 16

def og_title title
	 :meta, '', :property => "og:title", :content => title
end

#og_type(namespace, object_type) ⇒ Object



12
13
14
# File 'lib/facebook-social_plugins/helper/open_graph.rb', line 12

def og_type namespace, object_type
	 :meta, '', :property => "og:type", :content => "#{namespace}:#{object_type}"
end

#og_url(href) ⇒ Object



28
29
30
# File 'lib/facebook-social_plugins/helper/open_graph.rb', line 28

def og_url href
	 :meta, '', :property => "og:url", :content => href
end

#open_graph_meta(name, namespace, app_id, object_type, options = {}) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/facebook-social_plugins/helper/open_graph.rb', line 32

def open_graph_meta name, namespace, app_id, object_type, options = {}
	content = fb_app_id(app_id) + og_type(namespace, object_type)
	content << og_title(options[:title]) if options[:title]
	content << og_image(options[:img]) if options[:img]
	content << og_image(options[:desc]) if options[:desc]
	content << og_image(options[:url]) if options[:url]				
	og_header(name, namespace) do
		content
	end
end