Class: Taglish::Tagging
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Taglish::Tagging
- Includes:
- Util
- Defined in:
- lib/taglish/tagging.rb
Instance Method Summary collapse
- #==(object) ⇒ Object
- #name ⇒ Object
- #name=(v) ⇒ Object
-
#tag_type ⇒ Object
after_destroy :remove_unused_tags.
- #to_s ⇒ Object
Instance Method Details
#==(object) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/taglish/tagging.rb', line 30 def ==(object) super || ( object.is_a?(Tagging) && context == object.context && name == object.name && score == object.score) end |
#name ⇒ Object
21 22 23 |
# File 'lib/taglish/tagging.rb', line 21 def name @name ||= tag.name end |
#name=(v) ⇒ Object
25 26 27 28 |
# File 'lib/taglish/tagging.rb', line 25 def name=(v) raise "Can't change the name of a tag/tagging" if @name or (tag and tag.name) @name = v end |
#tag_type ⇒ Object
after_destroy :remove_unused_tags
17 18 19 |
# File 'lib/taglish/tagging.rb', line 17 def tag_type @tag_type ||= taggable.tag_types[context] end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/taglish/tagging.rb', line 38 def to_s score ? "#{name}:#{score}" : name end |