Class: Wordpress::WXR::Comment

Inherits:
Element
  • Object
show all
Defined in:
lib/wordpress/wxr/comment.rb

Instance Method Summary collapse

Methods inherited from Element

#initialize

Constructor Details

This class inherits a constructor from Wordpress::WXR::Element

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



32
33
34
35
36
37
# File 'lib/wordpress/wxr/comment.rb', line 32

def ==(other)
  self.class == other.class &&
    email == other.email &&
    date == other.date &&
    content == other.content
end

#approved?Boolean



28
29
30
# File 'lib/wordpress/wxr/comment.rb', line 28

def approved?
  node.xpath('wp:comment_approved').text.to_i == 1
end

#authorObject



8
9
10
# File 'lib/wordpress/wxr/comment.rb', line 8

def author
  node.xpath('wp:comment_author').text
end

#contentObject



24
25
26
# File 'lib/wordpress/wxr/comment.rb', line 24

def content
  node.xpath('wp:comment_content').text
end

#dateObject



20
21
22
# File 'lib/wordpress/wxr/comment.rb', line 20

def date
  DateTime.parse(node.xpath('wp:comment_date').text)
end

#emailObject



12
13
14
# File 'lib/wordpress/wxr/comment.rb', line 12

def email
  Mail::Address.new(node.xpath('wp:comment_author_email').text)
end

#urlObject



16
17
18
# File 'lib/wordpress/wxr/comment.rb', line 16

def url
  URI(node.xpath('wp:comment_author_url').text)
end