module Supertag::Hashtaggable

Public Instance Methods

hashtaggable_content() click to toggle source
# File lib/supertag/hashtaggable.rb, line 11
def hashtaggable_content
  self.class.hashtaggable_attribute # to ensure it has been called at least once
  content = self.send(self.class.hashtaggable_attribute_name)
  content.to_s
end
parsed_hashtags() click to toggle source
# File lib/supertag/hashtaggable.rb, line 21
def parsed_hashtags
  parsed_hashtags = []
  array_of_hashtags_as_string = scan_for_hashtags(hashtaggable_content)
  array_of_hashtags_as_string.each do |s|
    parsed_hashtags << Hashtag.find_or_create_by_name(s[1])
  end
  parsed_hashtags
end
scan_for_hashtags(content) click to toggle source
# File lib/supertag/hashtaggable.rb, line 30
def scan_for_hashtags(content)
  match = content.scan(Hashtag::HASHTAG_REGEX)
  match.uniq!
  match
end
update_hashtags() click to toggle source
# File lib/supertag/hashtaggable.rb, line 17
def update_hashtags
  self.hashtags = parsed_hashtags
end