module Supertag::Moneytaggable

Public Instance Methods

moneytaggable_content() click to toggle source
# File lib/supertag/moneytaggable.rb, line 11
def moneytaggable_content
  self.class.moneytaggable_attribute # to ensure it has been called at least once
  content = self.send(self.class.moneytaggable_attribute_name)
  content.to_s
end
parsed_moneytags() click to toggle source
# File lib/supertag/moneytaggable.rb, line 21
def parsed_moneytags
  parsed_moneytags = []
  array_of_moneytags_as_string = scan_for_moneytags(moneytaggable_content)
  array_of_moneytags_as_string.each do |s|
    parsed_moneytags << Moneytag.find_or_create_by_name(s[1])
  end
  parsed_moneytags
end
scan_for_moneytags(content) click to toggle source
# File lib/supertag/moneytaggable.rb, line 30
def scan_for_moneytags(content)
  match = content.scan(Moneytag::MONEYTAG_REGEX)
  match.uniq!
  match
end
update_moneytags() click to toggle source
# File lib/supertag/moneytaggable.rb, line 17
def update_moneytags
  self.moneytags = parsed_moneytags
end