Skip to content

Instantly share code, notes, and snippets.

@elia
Last active December 22, 2015 05:48
Show Gist options
  • Save elia/09acd7eda440a9ea02a7 to your computer and use it in GitHub Desktop.
Save elia/09acd7eda440a9ea02a7 to your computer and use it in GitHub Desktop.
attr_accessor :page, :viewer, :menu
def element
@element ||= Element
end
def with selector
sub_element = element.find(selector)
yield sub_element if sub_element.any?
end
def setup
with '.site-index' do |menu_element|
self.menu = MenuView.new(menu_element)
end
with 'section.page' do |page_element|
self.page = PageView.new(page_element)
end
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment