class DevTrainingBot::Topic
Constants
- REGEX
Attributes
title[RW]
Public Class Methods
new(title, author = 'Unknown')
click to toggle source
# File lib/dev_training_bot/models/topic.rb, line 11 def initialize(title, author = 'Unknown') @title = title @author = author || 'Unknown' end
parse(topic)
click to toggle source
# File lib/dev_training_bot/models/topic.rb, line 7 def self.parse(topic) topic.match(REGEX) { |matches| new(matches[:title], matches[:author]) } end
Public Instance Methods
==(other)
click to toggle source
# File lib/dev_training_bot/models/topic.rb, line 20 def ==(other) author == other.author && title == other.title end
to_s()
click to toggle source
# File lib/dev_training_bot/models/topic.rb, line 16 def to_s "#{author}: #{title}" end