ts_vector_tags 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # TsVectorTags
2
2
 
3
- A simple tagging library that uses the (fairly exotic) `ts_vector` type in PostgreSQL on top of ActiveRecord.
3
+ A simple tagging library that uses the (fairly exotic) `tsvector` type in PostgreSQL on top of ActiveRecord.
4
4
 
5
5
  ## Requirements
6
6
 
@@ -1,3 +1,3 @@
1
1
  module TsVectorTags
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,7 +1,6 @@
1
1
  require "ts_vector_tags/version"
2
2
 
3
3
  module TsVectorTags
4
- class MissingAttributeError < Exception; end
5
4
 
6
5
  module Standardizer
7
6
  class << self
@@ -17,11 +16,6 @@ module TsVectorTags
17
16
  end
18
17
 
19
18
  def self.included(base)
20
- unless base.instance_methods.include?(:tags_vector) && base.instance_methods.include?(:tags_vector=)
21
- msg = "The TsVectorTags mixin assumes that the underlying PostgreSQL table has a field `tags_vector` of type tsvector"
22
- raise TsVectorTags::MissingAttributeError.new(msg)
23
- end
24
-
25
19
  base.class_eval do
26
20
  scope :with_tags, lambda { |tags|
27
21
  where("tags_vector @@ to_tsquery('simple', ?) ", TsVectorTags::Standardizer.tagify(tags).join(' & '))
@@ -63,39 +63,4 @@ describe TsVectorTags do
63
63
  end
64
64
  end
65
65
 
66
- context "with the required attributes" do
67
- it "does not raise an exception" do
68
- lambda {
69
- class GoodThing
70
- def self.scope(name, options = {}); end
71
- attr_accessor :tags_vector
72
- include TsVectorTags
73
- end
74
- }.should_not raise_error
75
- end
76
- end
77
-
78
- context "without a tags_vector attribute" do
79
- it "raises a helpful exception when no tags_vector writer is present" do
80
- lambda {
81
- class OneBadThing
82
- def self.scope(name, options = {}); end
83
-
84
- attr_reader :tags_vector
85
- include TsVectorTags
86
- end
87
- }.should raise_error(TsVectorTags::MissingAttributeError)
88
- end
89
-
90
- it "raises a helpful exception when no tags_vector reader is pressent" do
91
- lambda {
92
- class AnotherBadThing
93
- def self.scope(name, options = {}); end
94
-
95
- attr_writer :tags_vector
96
- include TsVectorTags
97
- end
98
- }.should raise_error(TsVectorTags::MissingAttributeError)
99
- end
100
- end
101
66
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ts_vector_tags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2011-11-18 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
17
- requirement: &2161651360 !ruby/object:Gem::Requirement
17
+ requirement: &2160736940 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *2161651360
25
+ version_requirements: *2160736940
26
26
  description: Extremely simple, if somewhat exotic, mixin that uses the tsvector feature
27
27
  in postgresql to add tags to an ActiveRecord model.
28
28
  email: