Skip to content

Instantly share code, notes, and snippets.

@jferris
Created April 13, 2010 20:51
Show Gist options
  • Select an option

  • Save jferris/365067 to your computer and use it in GitHub Desktop.

Select an option

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