Class: Tumblr::Data::Regular

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) ⇒ Regular

Returns a new instance of Regular.



117
118
119
120
121
122
123
124
125
# File 'lib/tumblr.rb', line 117

def initialize(elt, tz)
  super
  if elt.elements["regular-title"]
    @title = elt.elements["regular-title"].text
  end
  if elt.elements["regular-body"]
    @body = elt.elements["regular-body"].text
  end
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



115
116
117
# File 'lib/tumblr.rb', line 115

def body
  @body
end

#titleObject

Returns the value of attribute title.



115
116
117
# File 'lib/tumblr.rb', line 115

def title
  @title
end

Instance Method Details

#to_xmlObject



127
128
129
130
131
132
133
134
135
136
137
# File 'lib/tumblr.rb', line 127

def to_xml
  elt = super
  elt.attributes["type"] = "regular"
  if @title
    (elt.add_element("regular-title")).text = @title
  end
  if @body
    (elt.add_element("regular-body")).text = @body
  end
  return elt
end