Sha256: 90b60811d51616bf1ecfc4724b7b90300e24461fb766db17b6d078ff02a7dcfa
Contents?: true
Size: 715 Bytes
Versions: 12
Compression:
Stored size: 715 Bytes
Contents
module Marvin # An abstract class for an IRC protocol # Parser. Used as a basis for expirimentation. class AbstractParser def self.parse(line) return self.new(line.strip).to_event end attr_accessor :line, :command, :event # Instantiates a parser instance, attempts to # parse it for it's command and it's event. def initialize(line) self.line = line self.command = self.class.parse!(line) self.event = self.command.to_event unless self.command.blank? end def to_event self.event end private def self.parse!(line) raise NotImplementedError, "Must be implemented in a subclass" end end end
Version data entries
12 entries across 12 versions & 2 rubygems