def add_link_attribute(mut_attr_string)
      range_pointer = Pointer.new(NSRange.type)
      attributes = mut_attr_string.attributesAtIndex(0, effectiveRange: range_pointer).dup

      attributes[NSFontAttributeName] = self.font
      attributes[NSForegroundColorAttributeName] = self.textColor
      mut_attr_string.addAttributes(attributes, range: range_pointer[0])

      active_elements.each do |type, elements|
        case type
        when :mention  then attributes[NSForegroundColorAttributeName] = mention_color
        when :hashtag  then attributes[NSForegroundColorAttributeName] = hashtag_color
        when :url      then attributes[NSForegroundColorAttributeName] = url_color
        when :category then attributes[NSForegroundColorAttributeName] = category_color
        end

        elements.each do |element|
          mut_attr_string.setAttributes(attributes, range: element.range)
        end
      end
    end
def add_link_attribute(mut_attr_string)
      range_pointer = Pointer.new(NSRange.type)
      attributes = mut_attr_string.attributesAtIndex(0, effectiveRange: range_pointer).dup

      attributes[NSFontAttributeName] = self.font
      attributes[NSForegroundColorAttributeName] = self.textColor
      mut_attr_string.addAttributes(attributes, range: range_pointer[0])

      active_elements.each do |type, elements|
        case type
        when :mention  then attributes[NSForegroundColorAttributeName] = mention_color
        when :hashtag  then attributes[NSForegroundColorAttributeName] = hashtag_color
        when :url      then attributes[NSForegroundColorAttributeName] = url_color
        when :category then attributes[NSForegroundColorAttributeName] = category_color
        end

        elements.each do |element|
          mut_attr_string.setAttributes(attributes, range: element.range)
        end
      end
    end
add link attribute