Class: OStatus::Thread
- Inherits:
-
Object
- Object
- OStatus::Thread
- Includes:
- Atom::Xml::Parseable
- Defined in:
- lib/ostatus/thread.rb
Overview
This will parse the Thread Atom extension
Instance Method Summary collapse
- #==(o) ⇒ Object
-
#initialize(o) ⇒ Thread
constructor
A new instance of Thread.
- #inspect ⇒ Object
- #length=(v) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(o) ⇒ Thread
Returns a new instance of Thread.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ostatus/thread.rb', line 12 def initialize(o) case o when XML::Reader if current_node_is?(o, 'in-reply-to') parse(o, :once => true) else raise ArgumentError, "Thread created with node other than thr:in-reply-to: #{o.name}" end when Hash [:href, :ref, :type, :source].each do |attr| self.send("#{attr}=", o[attr]) end else raise ArgumentError, "Don't know how to handle #{o}" end end |
Instance Method Details
#==(o) ⇒ Object
37 38 39 |
# File 'lib/ostatus/thread.rb', line 37 def ==(o) o.respond_to?(:href) && o.href == self.href end |
#inspect ⇒ Object
41 42 43 |
# File 'lib/ostatus/thread.rb', line 41 def inspect "<OStatus::Thread href:'#{href}' type:'#{type}'>" end |
#length=(v) ⇒ Object
29 30 31 |
# File 'lib/ostatus/thread.rb', line 29 def length=(v) @length = v.to_i end |
#to_s ⇒ Object
33 34 35 |
# File 'lib/ostatus/thread.rb', line 33 def to_s self.href end |