
This follows the README given earlier, at least in principle, but doesn't implement the entirety of QMP, by any stretch of the imagination. Notable by their absence are error responses, argument validation (for incoming and outgoing messsages of all types), and any visibility into qmp_capabilities. Also missing are integration tests.
22 lines
446 B
Ruby
22 lines
446 B
Ruby
module QMPClient
|
|
module Messages
|
|
class Message
|
|
|
|
# Can we build a Message from the object?
|
|
def self.represents?(obj)
|
|
obj.is_a?(Hash)
|
|
end
|
|
|
|
def represents?(obj)
|
|
self.class.represents?(obj)
|
|
end
|
|
# Create a new Message.
|
|
# @param[Hash] obj source data for the message.
|
|
def initialize
|
|
raise NotImplementedError.new("Can't instantiate base class")
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|