Skip to content

Instantly share code, notes, and snippets.

@g000001
Created December 13, 2013 20:01
Show Gist options
  • Save g000001/7950403 to your computer and use it in GitHub Desktop.
Save g000001/7950403 to your computer and use it in GitHub Desktop.
(defmethod xml ((o mop-document) &optional (fn #'values))
(concatenate 'string
"<doc>"
(funcall fn)
"</doc>"))
(defmethod xml ((o mop-report) &optional (fn #'values))
(call-next-method o
(lambda ()
(concatenate 'string
"<<title>foo</title>"
"<summary>bar</summary>"
"<body>"
(funcall fn)
"</body>"))))
(defmethod xml ((o mop-method-combination-report) &optional (fn #'values))
(call-next-method o (lambda () "hello!")))
(xml (make-instance 'mop-document))
;=> "<doc></doc>"
(xml (make-instance 'mop-report))
;=> "<doc><<title>foo</title><summary>bar</summary><body></body></doc>"
(xml (make-instance 'mop-method-combination-report))
;=> "<doc><<title>foo</title><summary>bar</summary><body>hello!</body></doc>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment