Class: WpxmlParser::Comment
- Inherits:
-
Entity
- Object
- Entity
- WpxmlParser::Comment
show all
- Defined in:
- lib/wpxml_parser/comment.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Entity
#method_missing
Constructor Details
#initialize(entity, post) ⇒ Comment
Returns a new instance of Comment.
6
7
8
9
|
# File 'lib/wpxml_parser/comment.rb', line 6
def initialize(entity, post)
super(entity)
@post = post
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class WpxmlParser::Entity
Class Method Details
.method_element_map ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/wpxml_parser/comment.rb', line 11
def self.method_element_map
{ :comment_id => 'wp:comment_id',
:author => 'wp:comment_author',
:email => 'wp:comment_author_email',
:url => 'wp:comment_author_url',
:ip => 'wp:comment_author_ip',
:date => 'wp:comment_date',
:date_gmt => 'wp:comment_date_gmt',
:body => 'wp:comment_content',
:approved => 'wp:comment_approved',
:parent_id => 'wp:comment_parent' }
end
|
Instance Method Details
#approved? ⇒ Boolean
32
33
34
|
# File 'lib/wpxml_parser/comment.rb', line 32
def approved?
approved == '1'
end
|
#children ⇒ Object
28
29
30
|
# File 'lib/wpxml_parser/comment.rb', line 28
def children
@post..select{|c| c.parent_id == }
end
|
#parent ⇒ Object
24
25
26
|
# File 'lib/wpxml_parser/comment.rb', line 24
def parent
@post..find{|c| c. == parent_id }
end
|
36
37
38
|
# File 'lib/wpxml_parser/comment.rb', line 36
def ()
.to_i
end
|
#process_date(date) ⇒ Object
48
49
50
|
# File 'lib/wpxml_parser/comment.rb', line 48
def process_date(date)
Time.parse(date)
end
|
#process_date_gmt(date) ⇒ Object
52
53
54
|
# File 'lib/wpxml_parser/comment.rb', line 52
def process_date_gmt(date)
Time.parse(date)
end
|
#process_parent_id(parent_id) ⇒ Object
40
41
42
|
# File 'lib/wpxml_parser/comment.rb', line 40
def process_parent_id(parent_id)
parent_id.to_i
end
|