Created
January 24, 2011 22:26
-
-
Save chewbranca/794104 to your computer and use it in GitHub Desktop.
This file contains 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
class ViewObject | |
include Enumerable | |
extend Forwardable | |
def_delegators :@views, :<<, :[], :[]=, :last, :first, :push | |
def initialize controller | |
@controller = controller | |
@views = [] | |
end | |
def each | |
@views.each {|view| yield view } | |
end | |
def render | |
@controller.send(:render, :template => "shared/view_object_template", :locals => { :view_object => self }) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment