Class: Tumblr::Data::Quote

Inherits:
Post
  • Object
show all
Defined in:
lib/tumblr.rb

Instance Attribute Summary collapse

Attributes inherited from Post

#bookmarklet, #date, #postid, #url

Instance Method Summary collapse

Constructor Details

#initialize(elt, tz) ⇒ Quote

Returns a new instance of Quote.



143
144
145
146
147
148
149
# File 'lib/tumblr.rb', line 143

def initialize(elt, tz)
  super
  @text = elt.elements["quote-text"].text
  if elt.elements["quote-source"]
    @source = elt.elements["quote-source"].text
  end
end

Instance Attribute Details

#sourceObject

Returns the value of attribute source.



141
142
143
# File 'lib/tumblr.rb', line 141

def source
  @source
end

#textObject

Returns the value of attribute text.



141
142
143
# File 'lib/tumblr.rb', line 141

def text
  @text
end

Instance Method Details

#to_xmlObject



151
152
153
154
155
156
157
158
159
160
# File 'lib/tumblr.rb', line 151

def to_xml
  elt = super
  elt.attributes["type"] = "quote"
  et = elt.add_element("quote-text")
  et.text = @text
  if @source
    (elt.add_element("quote-source")).text = @source
  end
  return elt
end