Class: DevTrainingBot::TopicService
- Inherits:
-
Object
- Object
- DevTrainingBot::TopicService
- Defined in:
- lib/dev_training_bot/services/topic_service.rb
Constant Summary collapse
- OPEN_TOPICS_REGEX =
/Open Topics\s+(\*.*\r\n)+/- TOPIC_ITEM_REGEX =
/(?<=\* ).*(?=\r)/
Instance Method Summary collapse
- #content ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(drive_service) ⇒ TopicService
constructor
A new instance of TopicService.
- #to_poll ⇒ Object
-
#topics ⇒ string
Returns a list of topics from a string in the following format:.
Constructor Details
#initialize(drive_service) ⇒ TopicService
Returns a new instance of TopicService.
6 7 8 |
# File 'lib/dev_training_bot/services/topic_service.rb', line 6 def initialize(drive_service) @drive_service = drive_service end |
Instance Method Details
#content ⇒ Object
15 16 17 |
# File 'lib/dev_training_bot/services/topic_service.rb', line 15 def content @content ||= @drive_service.export_file(ENV['FILE_ID'], 'text/plain', download_dest: StringIO.new) end |
#empty? ⇒ Boolean
37 38 39 |
# File 'lib/dev_training_bot/services/topic_service.rb', line 37 def empty? topics.empty? end |
#to_poll ⇒ Object
10 11 12 13 |
# File 'lib/dev_training_bot/services/topic_service.rb', line 10 def to_poll return '' if empty? "\"#{topics.join('" "')}\"" end |
#topics ⇒ string
Returns a list of topics from a string in the following format:
Open Topics
-
David: Browser rendering optimization: how to get silky smooth animations
-
David: The JS Event Loop: what nightmares are made of
-
David: RxJS: Observing the death of Promises
-
David: Intro to vim
-
Mo: Ansible
-
Julio: CSI:RMD Reading error reports like a $BOSS
-
Anthony: SAML
-
Jimmi: Gang of Four Design Patterns in Ruby (possibly in different parts)
33 34 35 |
# File 'lib/dev_training_bot/services/topic_service.rb', line 33 def topics @topics ||= import.map { |topic| Topic.parse(topic) } end |