Class: XfnStone::Person

Inherits:
Object
  • Object
show all
Defined in:
lib/xfn_stone/person.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, load_now = true) ⇒ Person

Returns a new instance of Person.



5
6
7
8
# File 'lib/xfn_stone/person.rb', line 5

def initialize(url, load_now = true)
  @uri = URI.parse(url)
  refresh if load_now
end

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



3
4
5
# File 'lib/xfn_stone/person.rb', line 3

def document
  @document
end

#uriObject (readonly)

Returns the value of attribute uri.



3
4
5
# File 'lib/xfn_stone/person.rb', line 3

def uri
  @uri
end

Instance Method Details

#contactsObject



14
15
16
# File 'lib/xfn_stone/person.rb', line 14

def contacts
  @document.elements("//a[@rel~=\"contact\"]")
end

#friendsObject



18
19
20
# File 'lib/xfn_stone/person.rb', line 18

def friends
  @document.elements("//a[@rel~=\"friend\"]")
end

#mineObject



22
23
24
# File 'lib/xfn_stone/person.rb', line 22

def mine
  @document.elements("//a[@rel~=\"me\"]")
end

#refreshObject



10
11
12
# File 'lib/xfn_stone/person.rb', line 10

def refresh
  @document = Document.create_from_uri(@uri)
end