pg_tags 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 62b956caabdc1c0e8959ce75c72796408b072887
4
+ data.tar.gz: 0554a3ad21b3e283dc273eaa8069d278d155aa9d
5
+ SHA512:
6
+ metadata.gz: 23329a19d51806ece4dea6c84452c94019fa94cf7a88bca1954d5c6feff11f63b2684ba3c3491663c0b6ee247f9f37b8759469ffdc4236779c263fa99b52a0aa
7
+ data.tar.gz: 2f8c94209db8b609823ebffbf325a802f51ae110907d064b0d3105edf4d71bf415606a53a4e0e491241ead04fe9d0a9e7b4f506793dbcceb2fa784c6ec74b433
@@ -0,0 +1,40 @@
1
+ module PgTags
2
+ module Taggable
3
+ def self.included(base)
4
+ base.extend(ClassMethod)
5
+ end
6
+
7
+ module ClassMethod
8
+ def has_tags(tag_name)
9
+
10
+ #== Scopes
11
+ scope :"with_any_#{tag_name}", ->(tags){ where("#{tag_name} && ARRAY[?]::varchar[]", parser.parse(tags)) }
12
+ # with_all_#{tag_name}
13
+ # with_only_#{tag_name}
14
+ # with_related_#{tag_name}
15
+ # without_any_#{tag_name}
16
+ # without_all_#{tag_name}
17
+
18
+ self.class.class_eval do
19
+
20
+ #== Class methods
21
+ define_method :"all_#{tag_name}" do |options = {}, &block|
22
+ "viewing all #{tag_name}"
23
+ end
24
+
25
+ # all_#{tag_name}s
26
+ # {tag_name}s_cloud
27
+ # related_#{tag_name}_to
28
+ # most_used_#{tag_name}s
29
+ # least_used_#{tag_name}s
30
+
31
+ end
32
+ end
33
+ end
34
+
35
+ # Instance methods
36
+ def some_instance_method
37
+ puts "some_instance_method"
38
+ end
39
+ end
40
+ end
data/lib/pg_tags.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'active_record'
2
+ require 'pg_tags/taggable'
3
+
4
+ ActiveSupport.on_load(:active_record) do
5
+ include PgTags::Taggable
6
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pg_tags
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Yos Riady
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-30 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: 'pg_tags is a simple and high performance tagging gem for Rails using
14
+ the PostgreSQL array type. An alternative to acts_as_taggable_on. Still a work in
15
+ progress and not ready for use! '
16
+ email: yosriady@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/pg_tags.rb
22
+ - lib/pg_tags/taggable.rb
23
+ homepage: http://github.com/Leventhan/pg_tags
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.0.6
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: pg_tags is a simple and high performance tagging gem for Rails using the
47
+ PostgreSQL array type.
48
+ test_files: []
49
+ has_rdoc: