Created
July 29, 2009 23:42
-
-
Save djanowski/158459 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
| # helpers do | |
| # def page | |
| # @page ||= Page.new | |
| # end | |
| # end | |
| class Page | |
| attr_accessor :title | |
| def initialize | |
| @attrs = {} | |
| @stylesheets = [] | |
| @javascripts = [] | |
| end | |
| def [](key) | |
| @attrs[key] | |
| end | |
| def []=(key, value) | |
| @attrs[key] = value | |
| end | |
| def stylesheet(name) | |
| @stylesheets << name | |
| end | |
| def javascript(name) | |
| @javascripts << name | |
| end | |
| def stylesheets | |
| ["reset"] + @stylesheets | |
| end | |
| def javascripts | |
| @javascripts | |
| end | |
| def to_s | |
| [@title, "Your app"].compact.join(" – ") | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment