Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 193
- Log:
First stage commit of Typo 4.1, modified for the ROOL site.
Includes all local modifications but a final pass needs to be
made to delete any files left over from earlier Typo versions
that shouldn't be here anymore. See the 'tags' section of the
repository for a clean Typo 4.1 tree.Note that symlinks to shared files in the RISC OS Open theme
directory have been deliberately included this time around; I
decided that on balance it was better to leave them in as
placeholders, since unlike symlinks in app/views/shared, the
Typo theme structure is not a standard Rails concept.
- Author:
- rool
- Date:
- Wed Apr 04 18:51:02 +0100 2007
- Size:
- 1077 Bytes
1 | require 'open-uri' |
2 | require 'time' |
3 | require 'rexml/document' |
4 | |
5 | class Technorati |
6 | include REXML |
7 | |
8 | def choose(num) |
9 | return cosmos unless cosmos.size > num |
10 | bag = [] |
11 | set = cosmos.dup |
12 | num.times {|x| bag << set.delete_at(rand(set.size))} |
13 | bag |
14 | end |
15 | |
16 | attr_accessor :url, :link, :title, :cosmos |
17 | |
18 | # This object holds given information of a picture |
19 | class Inbound < Struct.new(:link, :title) |
20 | def to_s; title end |
21 | end |
22 | |
23 | def initialize(url, refresh = true) |
24 | self.cosmos = [] |
25 | self.url = url |
26 | self.refresh if refresh |
27 | end |
28 | |
29 | # This method lets you refresh the tasks int the tasks array |
30 | # useful if you keep the object cached in memory and |
31 | def refresh |
32 | open(@url) do |http| |
33 | parse(http.read) |
34 | end |
35 | end |
36 | |
37 | private |
38 | |
39 | def parse(body) |
40 | xml = Document.new(body) |
41 | self.cosmos = [] |
42 | XPath.each(xml, "//item/") do |elem| |
43 | inbound = Inbound.new |
44 | inbound.title = XPath.match(elem, "title/text()").to_s |
45 | inbound.link = XPath.match(elem, "link/text()").to_s |
46 | cosmos << inbound |
47 | end |
48 | end |
49 | end |
50 | |
51 |