Sha256: 1361e5acf3b5ce30e2235daaabe91061c3e52394f64b59a471fd2e6af7354967
Contents?: true
Size: 488 Bytes
Versions: 10
Compression:
Stored size: 488 Bytes
Contents
module DevTrainingBot class Topic REGEX = /(?<author>.*?(?=:))?:?\s*(?<title>.+)/ attr_accessor :title, :author def self.parse(topic) topic.match(REGEX) { |matches| new(matches[:title], matches[:author]) } end def initialize(title, author = 'Unknown') @title = title @author = author || 'Unknown' end def to_s "#{author}: #{title}" end def ==(other) author == other.author && title == other.title end end end
Version data entries
10 entries across 10 versions & 1 rubygems