tagtical 1.0.7 → 1.0.8
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.
- data/Gemfile.lock +97 -0
 - data/VERSION +1 -1
 - data/lib/tagtical/tag.rb +22 -14
 - data/lib/tagtical/taggable/core.rb +1 -1
 - data/spec/tagtical/tag_spec.rb +31 -5
 - metadata +15 -14
 
    
        data/Gemfile.lock
    ADDED
    
    | 
         @@ -0,0 +1,97 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            GEM
         
     | 
| 
      
 2 
     | 
    
         
            +
              remote: http://rubygems.org/
         
     | 
| 
      
 3 
     | 
    
         
            +
              specs:
         
     | 
| 
      
 4 
     | 
    
         
            +
                abstract (1.0.0)
         
     | 
| 
      
 5 
     | 
    
         
            +
                actionmailer (3.0.5)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  actionpack (= 3.0.5)
         
     | 
| 
      
 7 
     | 
    
         
            +
                  mail (~> 2.2.15)
         
     | 
| 
      
 8 
     | 
    
         
            +
                actionpack (3.0.5)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  activemodel (= 3.0.5)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  activesupport (= 3.0.5)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  builder (~> 2.1.2)
         
     | 
| 
      
 12 
     | 
    
         
            +
                  erubis (~> 2.6.6)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  i18n (~> 0.4)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  rack (~> 1.2.1)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  rack-mount (~> 0.6.13)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  rack-test (~> 0.5.7)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  tzinfo (~> 0.3.23)
         
     | 
| 
      
 18 
     | 
    
         
            +
                activemodel (3.0.5)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  activesupport (= 3.0.5)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  builder (~> 2.1.2)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  i18n (~> 0.4)
         
     | 
| 
      
 22 
     | 
    
         
            +
                activerecord (3.0.5)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  activemodel (= 3.0.5)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  activesupport (= 3.0.5)
         
     | 
| 
      
 25 
     | 
    
         
            +
                  arel (~> 2.0.2)
         
     | 
| 
      
 26 
     | 
    
         
            +
                  tzinfo (~> 0.3.23)
         
     | 
| 
      
 27 
     | 
    
         
            +
                activeresource (3.0.5)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  activemodel (= 3.0.5)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  activesupport (= 3.0.5)
         
     | 
| 
      
 30 
     | 
    
         
            +
                activesupport (3.0.5)
         
     | 
| 
      
 31 
     | 
    
         
            +
                arel (2.0.10)
         
     | 
| 
      
 32 
     | 
    
         
            +
                builder (2.1.2)
         
     | 
| 
      
 33 
     | 
    
         
            +
                diff-lcs (1.1.2)
         
     | 
| 
      
 34 
     | 
    
         
            +
                erubis (2.6.6)
         
     | 
| 
      
 35 
     | 
    
         
            +
                  abstract (>= 1.0.0)
         
     | 
| 
      
 36 
     | 
    
         
            +
                git (1.2.5)
         
     | 
| 
      
 37 
     | 
    
         
            +
                i18n (0.6.0)
         
     | 
| 
      
 38 
     | 
    
         
            +
                jeweler (1.6.2)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  bundler (~> 1.0)
         
     | 
| 
      
 40 
     | 
    
         
            +
                  git (>= 1.2.5)
         
     | 
| 
      
 41 
     | 
    
         
            +
                  rake
         
     | 
| 
      
 42 
     | 
    
         
            +
                mail (2.2.19)
         
     | 
| 
      
 43 
     | 
    
         
            +
                  activesupport (>= 2.3.6)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  i18n (>= 0.4.0)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  mime-types (~> 1.16)
         
     | 
| 
      
 46 
     | 
    
         
            +
                  treetop (~> 1.4.8)
         
     | 
| 
      
 47 
     | 
    
         
            +
                mime-types (1.16)
         
     | 
| 
      
 48 
     | 
    
         
            +
                mocha (0.9.12)
         
     | 
| 
      
 49 
     | 
    
         
            +
                mysql (2.8.1)
         
     | 
| 
      
 50 
     | 
    
         
            +
                polyglot (0.3.1)
         
     | 
| 
      
 51 
     | 
    
         
            +
                rack (1.2.3)
         
     | 
| 
      
 52 
     | 
    
         
            +
                rack-mount (0.6.14)
         
     | 
| 
      
 53 
     | 
    
         
            +
                  rack (>= 1.0.0)
         
     | 
| 
      
 54 
     | 
    
         
            +
                rack-test (0.5.7)
         
     | 
| 
      
 55 
     | 
    
         
            +
                  rack (>= 1.0)
         
     | 
| 
      
 56 
     | 
    
         
            +
                rails (3.0.5)
         
     | 
| 
      
 57 
     | 
    
         
            +
                  actionmailer (= 3.0.5)
         
     | 
| 
      
 58 
     | 
    
         
            +
                  actionpack (= 3.0.5)
         
     | 
| 
      
 59 
     | 
    
         
            +
                  activerecord (= 3.0.5)
         
     | 
| 
      
 60 
     | 
    
         
            +
                  activeresource (= 3.0.5)
         
     | 
| 
      
 61 
     | 
    
         
            +
                  activesupport (= 3.0.5)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  bundler (~> 1.0)
         
     | 
| 
      
 63 
     | 
    
         
            +
                  railties (= 3.0.5)
         
     | 
| 
      
 64 
     | 
    
         
            +
                railties (3.0.5)
         
     | 
| 
      
 65 
     | 
    
         
            +
                  actionpack (= 3.0.5)
         
     | 
| 
      
 66 
     | 
    
         
            +
                  activesupport (= 3.0.5)
         
     | 
| 
      
 67 
     | 
    
         
            +
                  rake (>= 0.8.7)
         
     | 
| 
      
 68 
     | 
    
         
            +
                  thor (~> 0.14.4)
         
     | 
| 
      
 69 
     | 
    
         
            +
                rake (0.9.2)
         
     | 
| 
      
 70 
     | 
    
         
            +
                rcov (0.9.9)
         
     | 
| 
      
 71 
     | 
    
         
            +
                rspec (2.6.0)
         
     | 
| 
      
 72 
     | 
    
         
            +
                  rspec-core (~> 2.6.0)
         
     | 
| 
      
 73 
     | 
    
         
            +
                  rspec-expectations (~> 2.6.0)
         
     | 
| 
      
 74 
     | 
    
         
            +
                  rspec-mocks (~> 2.6.0)
         
     | 
| 
      
 75 
     | 
    
         
            +
                rspec-core (2.6.4)
         
     | 
| 
      
 76 
     | 
    
         
            +
                rspec-expectations (2.6.0)
         
     | 
| 
      
 77 
     | 
    
         
            +
                  diff-lcs (~> 1.1.2)
         
     | 
| 
      
 78 
     | 
    
         
            +
                rspec-mocks (2.6.0)
         
     | 
| 
      
 79 
     | 
    
         
            +
                sqlite3 (1.3.3)
         
     | 
| 
      
 80 
     | 
    
         
            +
                sqlite3-ruby (1.3.3)
         
     | 
| 
      
 81 
     | 
    
         
            +
                  sqlite3 (>= 1.3.3)
         
     | 
| 
      
 82 
     | 
    
         
            +
                thor (0.14.6)
         
     | 
| 
      
 83 
     | 
    
         
            +
                treetop (1.4.9)
         
     | 
| 
      
 84 
     | 
    
         
            +
                  polyglot (>= 0.3.1)
         
     | 
| 
      
 85 
     | 
    
         
            +
                tzinfo (0.3.29)
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
            PLATFORMS
         
     | 
| 
      
 88 
     | 
    
         
            +
              ruby
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
            DEPENDENCIES
         
     | 
| 
      
 91 
     | 
    
         
            +
              jeweler
         
     | 
| 
      
 92 
     | 
    
         
            +
              mocha
         
     | 
| 
      
 93 
     | 
    
         
            +
              mysql
         
     | 
| 
      
 94 
     | 
    
         
            +
              rails (<= 3.0.5)
         
     | 
| 
      
 95 
     | 
    
         
            +
              rcov
         
     | 
| 
      
 96 
     | 
    
         
            +
              rspec (<= 2.6.0)
         
     | 
| 
      
 97 
     | 
    
         
            +
              sqlite3-ruby
         
     | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            1.0. 
     | 
| 
      
 1 
     | 
    
         
            +
            1.0.8
         
     | 
    
        data/lib/tagtical/tag.rb
    CHANGED
    
    | 
         @@ -3,15 +3,15 @@ module Tagtical 
     | 
|
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
                attr_accessible :value
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
                ### ASSOCIATIONS:
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
6 
     | 
    
         
             
                has_many :taggings, :dependent => :destroy, :class_name => 'Tagtical::Tagging'
         
     | 
| 
       9 
7 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
      
 8 
     | 
    
         
            +
                scope(:type, lambda do |context, *args|
         
     | 
| 
      
 9 
     | 
    
         
            +
                  options = args.extract_options!
         
     | 
| 
      
 10 
     | 
    
         
            +
                  options[:type] = args[0] if args[0]
         
     | 
| 
      
 11 
     | 
    
         
            +
                  Type[context].scoping(options)
         
     | 
| 
      
 12 
     | 
    
         
            +
                end)
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
      
 14 
     | 
    
         
            +
                validates :value, :uniqueness => {:scope => :type}, :presence => true # type is not required, it can be blank
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
                class_attribute :possible_values
         
     | 
| 
       17 
17 
     | 
    
         
             
                validate :validate_possible_values
         
     | 
| 
         @@ -63,12 +63,8 @@ module Tagtical 
     | 
|
| 
       63 
63 
     | 
    
         
             
                    @sti_name = Tagtical::Tag==self ? nil : Type[name.demodulize].to_sti_name
         
     | 
| 
       64 
64 
     | 
    
         
             
                  end
         
     | 
| 
       65 
65 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
                  def  
     | 
| 
       67 
     | 
    
         
            -
                    ( 
     | 
| 
       68 
     | 
    
         
            -
                      scope(tag_type.scope_name, Proc.new { |options| tag_type.scoping(options || {}) })
         
     | 
| 
       69 
     | 
    
         
            -
                      define_method(:"#{tag_type}?") { is_a?(tag_type.klass!) }
         
     | 
| 
       70 
     | 
    
         
            -
                      true
         
     | 
| 
       71 
     | 
    
         
            -
                    end
         
     | 
| 
      
 66 
     | 
    
         
            +
                  def define_scope_for_type(tag_type)
         
     | 
| 
      
 67 
     | 
    
         
            +
                    scope(tag_type.scope_name, lambda { |*args| type(tag_type, *args) }) unless respond_to?(tag_type.scope_name)
         
     | 
| 
       72 
68 
     | 
    
         
             
                  end
         
     | 
| 
       73 
69 
     | 
    
         | 
| 
       74 
70 
     | 
    
         
             
                  protected
         
     | 
| 
         @@ -120,7 +116,7 @@ module Tagtical 
     | 
|
| 
       120 
116 
     | 
    
         | 
| 
       121 
117 
     | 
    
         
             
                def inspect
         
     | 
| 
       122 
118 
     | 
    
         
             
                  super.tap do |str|
         
     | 
| 
       123 
     | 
    
         
            -
                    str[- 
     | 
| 
      
 119 
     | 
    
         
            +
                    str[-1] = ", relevance: #{relevance}>" if relevance
         
     | 
| 
       124 
120 
     | 
    
         
             
                  end
         
     | 
| 
       125 
121 
     | 
    
         
             
                end
         
     | 
| 
       126 
122 
     | 
    
         | 
| 
         @@ -135,6 +131,18 @@ module Tagtical 
     | 
|
| 
       135 
131 
     | 
    
         | 
| 
       136 
132 
     | 
    
         
             
                private
         
     | 
| 
       137 
133 
     | 
    
         | 
| 
      
 134 
     | 
    
         
            +
                def method_missing(method_name, *args, &block)
         
     | 
| 
      
 135 
     | 
    
         
            +
                  if method_name[-1]=="?"
         
     | 
| 
      
 136 
     | 
    
         
            +
                    lambda = (klass = Type.new(method_name[0..-2]).klass) ?
         
     | 
| 
      
 137 
     | 
    
         
            +
                      lambda { is_a?(klass) } :
         
     | 
| 
      
 138 
     | 
    
         
            +
                      lambda { method_name[0..-2]==type }
         
     | 
| 
      
 139 
     | 
    
         
            +
                    self.class.send(:define_method, method_name, &lambda)
         
     | 
| 
      
 140 
     | 
    
         
            +
                    send(method_name)
         
     | 
| 
      
 141 
     | 
    
         
            +
                  else
         
     | 
| 
      
 142 
     | 
    
         
            +
                    super
         
     | 
| 
      
 143 
     | 
    
         
            +
                  end
         
     | 
| 
      
 144 
     | 
    
         
            +
                end
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
       138 
146 
     | 
    
         
             
                def validate_possible_values
         
     | 
| 
       139 
147 
     | 
    
         
             
                  if possible_values && !possible_values.include?(value)
         
     | 
| 
       140 
148 
     | 
    
         
             
                    errors.add(:value, %{Value "#{value}" not found in list: #{possible_values.inspect}})
         
     | 
| 
         @@ -308,7 +316,7 @@ module Tagtical 
     | 
|
| 
       308 
316 
     | 
    
         
             
                        return constant
         
     | 
| 
       309 
317 
     | 
    
         
             
                      end
         
     | 
| 
       310 
318 
     | 
    
         
             
                    end
         
     | 
| 
       311 
     | 
    
         
            -
             
     | 
| 
      
 319 
     | 
    
         
            +
                    
         
     | 
| 
       312 
320 
     | 
    
         
             
                    # Logic comes from ActiveRecord::Base#compute_type.
         
     | 
| 
       313 
321 
     | 
    
         
             
                    candidates.each do |candidate|
         
     | 
| 
       314 
322 
     | 
    
         
             
                      begin
         
     | 
| 
         @@ -24,7 +24,7 @@ module Tagtical::Taggable 
     | 
|
| 
       24 
24 
     | 
    
         
             
                      # This keeps your reflections cleaner.
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
                      # In the case of the base tag type, it will just use the :tags association defined above.
         
     | 
| 
       27 
     | 
    
         
            -
                      Tagtical::Tag. 
     | 
| 
      
 27 
     | 
    
         
            +
                      Tagtical::Tag.define_scope_for_type(tag_type)
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
                      # If the tag_type is base? (type=="tag"), then we add additional functionality to the AR
         
     | 
| 
       30 
30 
     | 
    
         
             
                      # has_many :tags.
         
     | 
    
        data/spec/tagtical/tag_spec.rb
    CHANGED
    
    | 
         @@ -57,7 +57,17 @@ describe Tagtical::Tag do 
     | 
|
| 
       57 
57 
     | 
    
         | 
| 
       58 
58 
     | 
    
         
             
              end
         
     | 
| 
       59 
59 
     | 
    
         | 
| 
       60 
     | 
    
         
            -
              describe " 
     | 
| 
      
 60 
     | 
    
         
            +
              describe ".type" do
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
                it "should accept :type condition as argument" do
         
     | 
| 
      
 63 
     | 
    
         
            +
                  @klass::Type.any_instance.expects(:scoping).with(:key => :value, :type => :>=)
         
     | 
| 
      
 64 
     | 
    
         
            +
                  @klass.type(:skills, :">=", :key => :value)
         
     | 
| 
      
 65 
     | 
    
         
            +
                end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
              end
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
              describe "dynamic type scopes" do
         
     | 
| 
      
 70 
     | 
    
         
            +
                
         
     | 
| 
       61 
71 
     | 
    
         
             
                before do
         
     | 
| 
       62 
72 
     | 
    
         
             
                  Tagtical::Tag.create(:value => "Plane")
         
     | 
| 
       63 
73 
     | 
    
         
             
                  Tag::Skill.create(:value => "Kung Fu")
         
     | 
| 
         @@ -65,6 +75,12 @@ describe Tagtical::Tag do 
     | 
|
| 
       65 
75 
     | 
    
         
             
                  NeedTag.create(:value => "chair") 
         
     | 
| 
       66 
76 
     | 
    
         
             
                end
         
     | 
| 
       67 
77 
     | 
    
         | 
| 
      
 78 
     | 
    
         
            +
                it "should accept :type condition separately from the options" do
         
     | 
| 
      
 79 
     | 
    
         
            +
                  Tagtical::Tag.skills(:current).should have_tag_values ["Kung Fu"]
         
     | 
| 
      
 80 
     | 
    
         
            +
                  Tagtical::Tag.skills(:==).should have_tag_values ["Kung Fu"]
         
     | 
| 
      
 81 
     | 
    
         
            +
                  Tagtical::Tag.crafts(:>).should have_tag_values ["Kung Fu", "Plane"]
         
     | 
| 
      
 82 
     | 
    
         
            +
                end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
       68 
84 
     | 
    
         
             
                context "when :type => :current or the alias :==" do
         
     | 
| 
       69 
85 
     | 
    
         
             
                  it "should retrieve current STI level tags" do
         
     | 
| 
       70 
86 
     | 
    
         
             
                    Tagtical::Tag.skills.should have_tag_values ["Kung Fu", "Painting"]
         
     | 
| 
         @@ -79,7 +95,7 @@ describe Tagtical::Tag do 
     | 
|
| 
       79 
95 
     | 
    
         
             
                    Tagtical::Tag.crafts(:type => :parents).should have_tag_values ["Kung Fu", "Plane"]
         
     | 
| 
       80 
96 
     | 
    
         
             
                    Tagtical::Tag.crafts(:type => :>).should have_tag_values ["Kung Fu", "Plane"]
         
     | 
| 
       81 
97 
     | 
    
         
             
                    Tagtical::Tag.skills(:type => :>).should have_tag_values ["Plane"]
         
     | 
| 
       82 
     | 
    
         
            -
                  end
         
     | 
| 
      
 98 
     | 
    
         
            +
                  end 
         
     | 
| 
       83 
99 
     | 
    
         
             
                end
         
     | 
| 
       84 
100 
     | 
    
         | 
| 
       85 
101 
     | 
    
         
             
                context "when :type => :childern or the alias :<" do
         
     | 
| 
         @@ -112,7 +128,7 @@ describe Tagtical::Tag do 
     | 
|
| 
       112 
128 
     | 
    
         
             
                end
         
     | 
| 
       113 
129 
     | 
    
         
             
              end
         
     | 
| 
       114 
130 
     | 
    
         | 
| 
       115 
     | 
    
         
            -
              describe ". 
     | 
| 
      
 131 
     | 
    
         
            +
              describe ".define_scope_for_type" do
         
     | 
| 
       116 
132 
     | 
    
         
             
                before do
         
     | 
| 
       117 
133 
     | 
    
         
             
                  @skill = Tag::Skill.new(:value => "baskeball")
         
     | 
| 
       118 
134 
     | 
    
         
             
                  @craft = Tag::Craft.new(:value => "pottery")
         
     | 
| 
         @@ -129,7 +145,7 @@ describe Tagtical::Tag do 
     | 
|
| 
       129 
145 
     | 
    
         
             
                  @craft.skill?.should be_true
         
     | 
| 
       130 
146 
     | 
    
         
             
                  @craft.craft?.should be_true
         
     | 
| 
       131 
147 
     | 
    
         
             
                end
         
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
       133 
149 
     | 
    
         
             
              end
         
     | 
| 
       134 
150 
     | 
    
         | 
| 
       135 
151 
     | 
    
         
             
              it "should refresh @value on value setter" do
         
     | 
| 
         @@ -139,14 +155,24 @@ describe Tagtical::Tag do 
     | 
|
| 
       139 
155 
     | 
    
         
             
                @tag.value.should == "bar"
         
     | 
| 
       140 
156 
     | 
    
         
             
              end
         
     | 
| 
       141 
157 
     | 
    
         | 
| 
      
 158 
     | 
    
         
            +
              describe "#inspect" do
         
     | 
| 
      
 159 
     | 
    
         
            +
             
     | 
| 
      
 160 
     | 
    
         
            +
                it "should append relevance when provided" do
         
     | 
| 
      
 161 
     | 
    
         
            +
                  @tag["relevance"] = "0.45"
         
     | 
| 
      
 162 
     | 
    
         
            +
                  @tag.inspect.should == "#<Tagtical::Tag id: nil, value: \"train\", type: nil, relevance: 0.45>"
         
     | 
| 
      
 163 
     | 
    
         
            +
                end
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
              end
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
       142 
167 
     | 
    
         
             
              describe "sort" do
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
       143 
169 
     | 
    
         
             
                before do
         
     | 
| 
       144 
170 
     | 
    
         
             
                  @tag1 = @klass.new(:value => "car").tap { |x| x["relevance"] = "2.5" }
         
     | 
| 
       145 
171 
     | 
    
         
             
                  @tag2 = @klass.new(:value => "plane").tap { |x| x["relevance"] = "1.7" }
         
     | 
| 
       146 
172 
     | 
    
         
             
                  @tag3 = @klass.new(:value => "bike").tap { |x| x["relevance"] = "1.1" }
         
     | 
| 
       147 
173 
     | 
    
         
             
                  @tags = [@tag1, @tag2, @tag3]
         
     | 
| 
       148 
174 
     | 
    
         
             
                end
         
     | 
| 
       149 
     | 
    
         
            -
             
     | 
| 
      
 175 
     | 
    
         
            +
             
     | 
| 
       150 
176 
     | 
    
         
             
                it "should sort by relevance if all tags have them" do
         
     | 
| 
       151 
177 
     | 
    
         
             
                  @tags.sort.map(&:value).should == ["bike", "plane", "car"]
         
     | 
| 
       152 
178 
     | 
    
         
             
                end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: tagtical
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.8
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,11 +9,11 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2011-07- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2011-07-14 00:00:00.000000000Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: rails
         
     | 
| 
       16 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: &2158000180 !ruby/object:Gem::Requirement
         
     | 
| 
       17 
17 
     | 
    
         
             
                none: false
         
     | 
| 
       18 
18 
     | 
    
         
             
                requirements:
         
     | 
| 
       19 
19 
     | 
    
         
             
                - - <=
         
     | 
| 
         @@ -21,10 +21,10 @@ dependencies: 
     | 
|
| 
       21 
21 
     | 
    
         
             
                    version: 3.0.5
         
     | 
| 
       22 
22 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       23 
23 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       24 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: *2158000180
         
     | 
| 
       25 
25 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       26 
26 
     | 
    
         
             
              name: rspec
         
     | 
| 
       27 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 27 
     | 
    
         
            +
              requirement: &2157999700 !ruby/object:Gem::Requirement
         
     | 
| 
       28 
28 
     | 
    
         
             
                none: false
         
     | 
| 
       29 
29 
     | 
    
         
             
                requirements:
         
     | 
| 
       30 
30 
     | 
    
         
             
                - - <=
         
     | 
| 
         @@ -32,10 +32,10 @@ dependencies: 
     | 
|
| 
       32 
32 
     | 
    
         
             
                    version: 2.6.0
         
     | 
| 
       33 
33 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       34 
34 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       35 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 35 
     | 
    
         
            +
              version_requirements: *2157999700
         
     | 
| 
       36 
36 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       37 
37 
     | 
    
         
             
              name: sqlite3-ruby
         
     | 
| 
       38 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 38 
     | 
    
         
            +
              requirement: &2157999220 !ruby/object:Gem::Requirement
         
     | 
| 
       39 
39 
     | 
    
         
             
                none: false
         
     | 
| 
       40 
40 
     | 
    
         
             
                requirements:
         
     | 
| 
       41 
41 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -43,10 +43,10 @@ dependencies: 
     | 
|
| 
       43 
43 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       44 
44 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       45 
45 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       46 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 46 
     | 
    
         
            +
              version_requirements: *2157999220
         
     | 
| 
       47 
47 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       48 
48 
     | 
    
         
             
              name: mysql
         
     | 
| 
       49 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 49 
     | 
    
         
            +
              requirement: &2157998740 !ruby/object:Gem::Requirement
         
     | 
| 
       50 
50 
     | 
    
         
             
                none: false
         
     | 
| 
       51 
51 
     | 
    
         
             
                requirements:
         
     | 
| 
       52 
52 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -54,10 +54,10 @@ dependencies: 
     | 
|
| 
       54 
54 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       55 
55 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       56 
56 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       57 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 57 
     | 
    
         
            +
              version_requirements: *2157998740
         
     | 
| 
       58 
58 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       59 
59 
     | 
    
         
             
              name: jeweler
         
     | 
| 
       60 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 60 
     | 
    
         
            +
              requirement: &2157998260 !ruby/object:Gem::Requirement
         
     | 
| 
       61 
61 
     | 
    
         
             
                none: false
         
     | 
| 
       62 
62 
     | 
    
         
             
                requirements:
         
     | 
| 
       63 
63 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -65,10 +65,10 @@ dependencies: 
     | 
|
| 
       65 
65 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       66 
66 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       67 
67 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       68 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 68 
     | 
    
         
            +
              version_requirements: *2157998260
         
     | 
| 
       69 
69 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       70 
70 
     | 
    
         
             
              name: rcov
         
     | 
| 
       71 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: &2157997780 !ruby/object:Gem::Requirement
         
     | 
| 
       72 
72 
     | 
    
         
             
                none: false
         
     | 
| 
       73 
73 
     | 
    
         
             
                requirements:
         
     | 
| 
       74 
74 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -76,7 +76,7 @@ dependencies: 
     | 
|
| 
       76 
76 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       77 
77 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       78 
78 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       79 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 79 
     | 
    
         
            +
              version_requirements: *2157997780
         
     | 
| 
       80 
80 
     | 
    
         
             
            description: Tagtical allows you do create subclasses for Tag and add additional functionality
         
     | 
| 
       81 
81 
     | 
    
         
             
              in an STI fashion. For example. You could do Tag::Color.find_by_name('blue').to_rgb.
         
     | 
| 
       82 
82 
     | 
    
         
             
              It also supports storing weights or relevance on the taggings.
         
     | 
| 
         @@ -88,6 +88,7 @@ extra_rdoc_files: 
     | 
|
| 
       88 
88 
     | 
    
         
             
            files:
         
     | 
| 
       89 
89 
     | 
    
         
             
            - CHANGELOG
         
     | 
| 
       90 
90 
     | 
    
         
             
            - Gemfile
         
     | 
| 
      
 91 
     | 
    
         
            +
            - Gemfile.lock
         
     | 
| 
       91 
92 
     | 
    
         
             
            - MIT-LICENSE
         
     | 
| 
       92 
93 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
       93 
94 
     | 
    
         
             
            - Rakefile
         
     |