Module: Odania::Taggable::Core::InstanceMethods
- Includes:
- TagModule
- Defined in:
- lib/odania/taggable/core.rb
Instance Method Summary collapse
- #is_taggable? ⇒ Boolean
- #save_tags ⇒ Object
- #set_tag_list_on(context, new_list) ⇒ Object
- #tag_counts_on(context) ⇒ Object
- #tag_list_on(context) ⇒ Object
Methods included from TagModule
Instance Method Details
#is_taggable? ⇒ Boolean
46 47 48 |
# File 'lib/odania/taggable/core.rb', line 46 def is_taggable? self.class.is_taggable? end |
#save_tags ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/odania/taggable/core.rb', line 68 def tag_types.map(&:to_s).each do || = tag_list_on() old_variable_name = "@#{.to_s.singularize}_list_old" = instance_variable_get(old_variable_name) (, , ) 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 |