Created
April 13, 2010 20:51
-
-
Save jferris/365067 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 HarmonyHelpers | |
| def haromeny_page | |
| anchor = URI.parse(root_url).merge(current_url).fragment | |
| Harmony::AnchoredPage.new(current_page_body, anchor) | |
| end | |
| end | |
| module Harmony | |
| class Page | |
| module Window | |
| def from_document(document, anchor = nil) | |
| Tempfile.open('harmony') {|f| f << document; @path = f.path } | |
| from_uri("file://#{@path}#{('#' + anchor) if anchor}") | |
| end | |
| end | |
| end | |
| class AnchoredPage < Page | |
| def initialize(document=nil, anchor=nil) | |
| @anchor = anchor | |
| @window = Window.from_document(document, anchor) if document | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment