metatags 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ require 'metatags/version'
2
+ require 'metatags/metatags'
3
+ require 'metatags/railtie' if defined? Rails
@@ -0,0 +1,28 @@
1
+ module Metatags
2
+
3
+ module ControllerMethods
4
+ def self.included(base)
5
+ base.send(:helper_method, :metatags_collection)
6
+ end
7
+
8
+ def add_meta(attrs = {}, &block)
9
+ metatags_collection << [attrs, block]
10
+ end
11
+
12
+ def metatags_collection
13
+ @metatags ||= []
14
+ end
15
+ end
16
+
17
+ module HelperMethods
18
+ def metatags
19
+ tags = []
20
+ metatags_collection.each do |meta|
21
+ attrs, block = meta
22
+ attrs.merge!(instance_eval(&block)) unless block.nil?
23
+ tags << tag(:meta, attrs)
24
+ end
25
+ raw tags.join("\n")
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,8 @@
1
+ module Metatags
2
+ class Railtie < Rails::Railtie
3
+ initializer "application_controller.init_metatags" do
4
+ ActionController::Base.send :include, Metatags::ControllerMethods
5
+ ActionView::Base.send :include, Metatags::HelperMethods
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module Metatags
2
+ VERSION = "0.1"
3
+ end
File without changes
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: metatags
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - John Butler
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-29 00:00:00.000000000 +00:00
13
+ default_executable:
14
+ dependencies: []
15
+ description:
16
+ email: johnnypez@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/metatags/metatags.rb
22
+ - lib/metatags/railtie.rb
23
+ - lib/metatags/version.rb
24
+ - lib/metatags.rb
25
+ - readme.markdown
26
+ has_rdoc: true
27
+ homepage: http://github.com/johnnypez/metatags
28
+ licenses: []
29
+ post_install_message:
30
+ rdoc_options: []
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ requirements: []
46
+ rubyforge_project:
47
+ rubygems_version: 1.6.2
48
+ signing_key:
49
+ specification_version: 3
50
+ summary: A simple meta tag generator that doesn't fuck with the attributes that you're
51
+ setting.
52
+ test_files: []