Created
February 15, 2012 16:29
-
-
Save practicingruby/1837078 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Prawn | |
| class Drawing | |
| # should work as a drop-in, as all of this | |
| # stuff will proxy to Document | |
| include Prawn::Graphics | |
| def initialize(document) | |
| self.document = document | |
| end | |
| def method_missing(id, *a, &b) | |
| document.send(id, *a, &b) | |
| end | |
| private | |
| attr_accessor :document | |
| end | |
| class Document | |
| extend Forwardable | |
| # this makes the semver features clear | |
| delegates [:stroke, :fill, :line, ...] => :drawing | |
| def initialize(*a, &b) | |
| self.drawing = Prawn::Drawing.new | |
| end | |
| private | |
| attr_accessor :drawing | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment