Class: WpxmlParser::Post
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Entity
#initialize, #method_missing
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
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/wpxml_parser/post.rb', line 6
def self.method_element_map
{ :title => 'title',
:link => 'link',
:date => 'pubDate',
:author => 'dc:creator',
:body => 'content:encoded',
:post_id => 'wp:post_id',
:slug => 'wp:post_name',
:status => 'wp:status',
:post_type => 'wp:post_type' }
end
|
Instance Method Details
#categories ⇒ Object
18
19
20
|
# File 'lib/wpxml_parser/post.rb', line 18
def categories
@entity.xpath('category').map(&:content).uniq
end
|
22
23
24
25
26
|
# File 'lib/wpxml_parser/post.rb', line 22
def
@entity.xpath('wp:comment').map do ||
Comment.new(, self)
end.select(&:approved?)
end
|
28
29
30
|
# File 'lib/wpxml_parser/post.rb', line 28
def ()
.find{|c| c. == }
end
|
#process_date(date) ⇒ Object
32
33
34
|
# File 'lib/wpxml_parser/post.rb', line 32
def process_date(date)
Time.parse(date)
end
|
#process_post_id(post_id) ⇒ Object
36
37
38
|
# File 'lib/wpxml_parser/post.rb', line 36
def process_post_id(post_id)
post_id.to_i
end
|