Class: Tumblr::Data::Conversation
Instance Attribute Summary collapse
-
#lines ⇒ Object
Returns the value of attribute lines.
-
#title ⇒ Object
Returns the value of attribute title.
Attributes inherited from Post
#bookmarklet, #date, #postid, #url
Instance Method Summary collapse
-
#initialize(elt, tz) ⇒ Conversation
constructor
A new instance of Conversation.
- #to_xml ⇒ Object
Constructor Details
#initialize(elt, tz) ⇒ Conversation
Returns a new instance of Conversation.
217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/tumblr.rb', line 217 def initialize(elt, tz) super if elt.elements["conversation-title"] @title = elt.elements["conversation-title"] end @text = elt.elements["conversation-text"].text @lines = [] elt.elements.each("conversation-line") do |line| name = line.attributes["name"] label = line.attributes["label"] @lines << [name, label, line.text] end end |
Instance Attribute Details
#lines ⇒ Object
Returns the value of attribute lines.
215 216 217 |
# File 'lib/tumblr.rb', line 215 def lines @lines end |
#title ⇒ Object
Returns the value of attribute title.
215 216 217 |
# File 'lib/tumblr.rb', line 215 def title @title end |
Instance Method Details
#to_xml ⇒ Object
231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/tumblr.rb', line 231 def to_xml elt = super elt.attributes["type"] = "conversation" if @title (elt.add_element "conversation-title").text = @title end text = elt.add_element "conversation-text" text.text = @text @lines.each do |line| e = elt.add_element "conversation-line", {"name" => line[0], "label" => line[1]} e.text = line[2] end return elt end |