Module: Odania::Taggable::Core::InstanceMethods

Includes:
TagModule
Defined in:
lib/odania/taggable/core.rb

Instance Method Summary collapse

Methods included from TagModule

#update_tags

Instance Method Details

#is_taggable?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/odania/taggable/core.rb', line 46

def is_taggable?
	self.class.is_taggable?
end

#save_tagsObject



68
69
70
71
72
73
74
75
76
77
78
# File 'lib/odania/taggable/core.rb', line 68

def save_tags
	tag_types.map(&:to_s).each do |tags_type|
		new_tags = tag_list_on(tags_type)
		old_variable_name = "@#{tags_type.to_s.singularize}_list_old"
		old_tags = instance_variable_get(old_variable_name)

		update_tags(old_tags, new_tags, tags_type)
	end

	true
end

#set_tag_list_on(context, new_list) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/odania/taggable/core.rb', line 50

def set_tag_list_on(context, new_list)
	variable_name = "@#{context.to_s.singularize}_list"
	if new_list != tag_list_on(context)
		old_variable_name = "@#{context.to_s.singularize}_list_old"
		instance_variable_set(old_variable_name, tag_list_on(context))
	end
	instance_variable_set(variable_name, new_list)
end

#tag_counts_on(context) ⇒ Object



64
65
66
# File 'lib/odania/taggable/core.rb', line 64

def tag_counts_on(context)

end

#tag_list_on(context) ⇒ Object



59
60
61
62
# File 'lib/odania/taggable/core.rb', line 59

def tag_list_on(context)
	variable_name = "@#{context.to_s.singularize}_list"
	instance_variable_get(variable_name)
end