You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
409 B

8 years ago
8 years ago
  1. module ApplicationHelper
  2. def unique_tag(date, id, type)
  3. "tag:#{LOCAL_DOMAIN},#{date.strftime('%Y-%m-%d')}:objectId=#{id}:objectType=#{type}"
  4. end
  5. def unique_tag_to_local_id(tag, expected_type)
  6. matches = Regexp.new("objectId=([\\d]+):objectType=#{expected_type}").match(tag)
  7. return matches[1] unless matches.nil?
  8. end
  9. def local_id?(id)
  10. id.start_with?("tag:#{LOCAL_DOMAIN}")
  11. end
  12. end