class Gutentag::Persistence
Attributes
change_state[R]
tagger[W]
Public Class Methods
new(change_state)
click to toggle source
# File lib/gutentag/persistence.rb, line 10 def initialize(change_state) @change_state = change_state end
Public Instance Methods
persist()
click to toggle source
# File lib/gutentag/persistence.rb, line 14 def persist remove_old add_new end
Private Instance Methods
add_new()
click to toggle source
# File lib/gutentag/persistence.rb, line 25 def add_new added.each do |name| taggable.tags << tagger.find_or_create(name) end end
remove_old()
click to toggle source
# File lib/gutentag/persistence.rb, line 31 def remove_old removed.each do |name| taggable.tags.delete tagger.find_by_name(name) end end
tagger()
click to toggle source
# File lib/gutentag/persistence.rb, line 37 def tagger @tagger ||= Gutentag::Tag end