class Gutentag::ChangeState

Attributes

changes[R]
existing[R]
normaliser[W]
taggable[R]

Public Class Methods

new(taggable) click to toggle source
# File lib/gutentag/change_state.rb, line 7
def initialize(taggable)
  @taggable = taggable
  @existing = normalised taggable.tags.collect(&:name)
  @changes  = normalised taggable.tag_names
end

Public Instance Methods

added() click to toggle source
# File lib/gutentag/change_state.rb, line 13
def added
  @added ||= changes - existing
end
removed() click to toggle source
# File lib/gutentag/change_state.rb, line 17
def removed
  @removed ||= existing - changes
end

Private Instance Methods

normalised(names) click to toggle source
# File lib/gutentag/change_state.rb, line 25
def normalised(names)
  names.collect { |name| normaliser.call(name) }.uniq
end
normaliser() click to toggle source
# File lib/gutentag/change_state.rb, line 29
def normaliser
  @normaliser ||= proc { |name| Gutentag.normaliser.call(name) }
end