@frank_west_iii thanks for your response. I got it working here:
class Mentionee
attr_reader :id, :display_name
FORMAT = /@\[(?<id>\d+):(?<display_name>[^\]]+)\]/
def initialize(id:, display_name:)
@id = Integer(id)
@display_name = display_name
end
def self.parse(text)
text.to_enum(:scan, FORMAT).map do
match = Regexp.last_match
new(id: match[:id], display_name: match[:display_name])
end
end
end