module Supertag::Usertaggable

Public Instance Methods

parsed_usertags() click to toggle source
# File lib/supertag/usertaggable.rb, line 21
def parsed_usertags
  parsed_usertags = []
  array_of_usertags_as_string = scan_for_usertags(usertaggable_content)
  array_of_usertags_as_string.each do |s|
    parsed_usertags << Usertag.find_or_create_by_name(s[1])
  end
  parsed_usertags
end
scan_for_usertags(content) click to toggle source
# File lib/supertag/usertaggable.rb, line 30
def scan_for_usertags(content)
  match = content.scan(Usertag::USERTAG_REGEX)
  match.uniq!
  match
end
update_usertags() click to toggle source
# File lib/supertag/usertaggable.rb, line 17
def update_usertags
  self.usertags = parsed_usertags
end
usertaggable_content() click to toggle source
# File lib/supertag/usertaggable.rb, line 11
def usertaggable_content
  self.class.usertaggable_attribute # to ensure it has been called at least once
  content = self.send(self.class.usertaggable_attribute_name)
  content.to_s
end