Skip to content

Instantly share code, notes, and snippets.

@djanowski
Created July 29, 2009 23:42
Show Gist options
  • Select an option

  • Save djanowski/158459 to your computer and use it in GitHub Desktop.

Select an option

Save djanowski/158459 to your computer and use it in GitHub Desktop.
# 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