open_graph_protocol 0.0.0 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ require 'open_graph_protocol/view_helpers'
2
+
3
+ module OpenGraphProtocol
4
+ class Railtie < Rails::Railtie
5
+ initializer "open_graph_protocol.view_helpers" do
6
+ ActionView::Base.send :include, ViewHelpers
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,28 @@
1
+ module OpenGraphProtocol
2
+ module ViewHelpers
3
+
4
+ def og_title(text)
5
+ og_tag('og:title', text)
6
+ end
7
+
8
+ def og_type(type)
9
+ og_tag('og:type', type)
10
+ end
11
+
12
+ def og_image(image)
13
+ og_tag('og:image', image)
14
+ end
15
+
16
+ def og_url(url)
17
+ og_tag('og:url', url)
18
+ end
19
+
20
+ private
21
+
22
+ def og_tag(property, content)
23
+ return if content.nil? or content.empty?
24
+ tag :meta, {property: property, content: content}
25
+ end
26
+
27
+ end
28
+ end
@@ -1,3 +1 @@
1
- class OpenGraphProtocol
2
- # just a stub to put the files in place
3
- end
1
+ require 'open_graph_protocol/railtie' if defined?(Rails)
metadata CHANGED
@@ -1,48 +1,50 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open_graph_protocol
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.0
4
+ version: 0.0.2
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Enable Labs
9
9
  - John Fitzpatrick
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
  date: 2013-02-26 00:00:00.000000000 Z
14
14
  dependencies: []
15
- description: A gem to facilitate populating the open graph protocol metatags on a web page
15
+ description: A gem to facilitate populating the open graph protocol metatags on a
16
+ web page as part of a rails helper.
16
17
  email: john@enablelabs.com
17
18
  executables: []
18
19
  extensions: []
19
20
  extra_rdoc_files: []
20
21
  files:
21
22
  - lib/open_graph_protocol.rb
23
+ - lib/open_graph_protocol/railtie.rb
24
+ - lib/open_graph_protocol/view_helpers.rb
22
25
  homepage: https://github.com/EnableLabs/open_graph_protocol
23
26
  licenses: []
24
- post_install_message:
27
+ post_install_message:
25
28
  rdoc_options: []
26
29
  require_paths:
27
30
  - lib
28
31
  required_ruby_version: !ruby/object:Gem::Requirement
32
+ none: false
29
33
  requirements:
30
- - - ">="
34
+ - - ! '>='
31
35
  - !ruby/object:Gem::Version
32
- version: !binary |-
33
- MA==
34
- none: false
36
+ version: '0'
35
37
  required_rubygems_version: !ruby/object:Gem::Requirement
38
+ none: false
36
39
  requirements:
37
- - - ">="
40
+ - - ! '>='
38
41
  - !ruby/object:Gem::Version
39
- version: !binary |-
40
- MA==
41
- none: false
42
+ version: '0'
42
43
  requirements: []
43
- rubyforge_project:
44
- rubygems_version: 1.8.24
45
- signing_key:
44
+ rubyforge_project:
45
+ rubygems_version: 1.8.25
46
+ signing_key:
46
47
  specification_version: 3
47
- summary: A gem to facilitate populating the open graph protocol metatags on a web page
48
+ summary: A gem to facilitate populating the open graph protocol metatags on a web
49
+ page
48
50
  test_files: []