module ActsAsTaggableOn::Taggable::Ownership
Public Instance Methods
acts_as_taggable_on(*args)
click to toggle source
Calls superclass method
# File lib/acts-as-taggable-on/taggable/ownership.rb, line 15 def acts_as_taggable_on(*args) initialize_acts_as_taggable_on_ownership super(*args) end
cached_owned_tag_list_on(context)
click to toggle source
# File lib/acts-as-taggable-on/taggable/ownership.rb, line 60 def cached_owned_tag_list_on(context) variable_name = "@owned_#{context}_list" (instance_variable_defined?(variable_name) && instance_variable_get(variable_name)) || instance_variable_set( variable_name, {} ) end
initialize_acts_as_taggable_on_ownership()
click to toggle source
# File lib/acts-as-taggable-on/taggable/ownership.rb, line 20 def initialize_acts_as_taggable_on_ownership tag_types.map(&:to_s).each do |tag_type| class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{tag_type}_from(owner) owner_tag_list_on(owner, '#{tag_type}') end RUBY end end
owner_tag_list_on(owner, context)
click to toggle source
# File lib/acts-as-taggable-on/taggable/ownership.rb, line 67 def owner_tag_list_on(owner, context) add_custom_context(context) cache = cached_owned_tag_list_on(context) cache[owner] ||= ActsAsTaggableOn::TagList.new(*owner_tags_on(owner, context).map(&:name)) end
reload(*args)
click to toggle source
Calls superclass method
# File lib/acts-as-taggable-on/taggable/ownership.rb, line 83 def reload(*args) self.class.tag_types.each do |context| instance_variable_set("@owned_#{context}_list", nil) end super(*args) end
set_owner_tag_list_on(owner, context, new_list)
click to toggle source
# File lib/acts-as-taggable-on/taggable/ownership.rb, line 75 def set_owner_tag_list_on(owner, context, new_list) add_custom_context(context) cache = cached_owned_tag_list_on(context) cache[owner] = ActsAsTaggableOn.default_parser.new(new_list).parse end