class Tjplurk::Robot::Topic

Attributes

name[RW]
pattern[RW]
responses[RW]

Public Class Methods

load(yaml) click to toggle source
# File lib/tjplurk/robot/topic.rb, line 9
def load yaml
  YAML.load(yaml).map do |attributes|
    topic = self.new name: attributes['name'], pattern: attributes['pattern']
    topic.responses = attributes['responses'].map{|res| Response.new(topic: topic, content: res)}
    topic
  end
end
new(**params) click to toggle source
# File lib/tjplurk/robot/topic.rb, line 18
def initialize(**params)
  params.each{|key, value| send("#{key}=", value)}
end