Class: XfnStone::Person
- Inherits:
-
Object
- Object
- XfnStone::Person
- Defined in:
- lib/xfn_stone/person.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #contacts ⇒ Object
- #friends ⇒ Object
-
#initialize(url, load_now = true) ⇒ Person
constructor
A new instance of Person.
- #mine ⇒ Object
- #refresh ⇒ Object
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
#document ⇒ Object (readonly)
Returns the value of attribute document.
3 4 5 |
# File 'lib/xfn_stone/person.rb', line 3 def document @document end |
#uri ⇒ Object (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
#contacts ⇒ Object
14 15 16 |
# File 'lib/xfn_stone/person.rb', line 14 def contacts @document.elements("//a[@rel~=\"contact\"]") end |
#friends ⇒ Object
18 19 20 |
# File 'lib/xfn_stone/person.rb', line 18 def friends @document.elements("//a[@rel~=\"friend\"]") end |
#mine ⇒ Object
22 23 24 |
# File 'lib/xfn_stone/person.rb', line 22 def mine @document.elements("//a[@rel~=\"me\"]") end |
#refresh ⇒ Object
10 11 12 |
# File 'lib/xfn_stone/person.rb', line 10 def refresh @document = Document.create_from_uri(@uri) end |