Skip to content

Commit

Permalink
* tippytippytepee/tepee.rb: Web.get will read local wiki pages as we…
Browse files Browse the repository at this point in the history
…ll. Web.get("HomePage"), for instance.
  • Loading branch information
_why committed Jan 19, 2007
1 parent 8e7e4e1 commit 795f215
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion examples/tippytippytepee/tepee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,25 @@

module Web
def self.get(url)
data = URI.parse(url).read
uri = URI.parse(url)
data = nil
case uri
when URI::HTTP
data = uri.read
when URI::Generic
page = Tepee.get(:Show, url)
def page.meta; @env end
def page.base_uri; end
data = page.body.to_s
OpenURI::Meta.init(data, page)
end
case data.content_type
when "application/x-javascript", "application/x-json", "application/json"
obj = JSON.parse(data)
OpenURI::Meta.init(obj, data)
obj
else
data
end
end
end
Expand Down

0 comments on commit 795f215

Please sign in to comment.