Class: Workarea::Blog::Import::Wordpress::EntryParser
- Inherits:
-
Object
- Object
- Workarea::Blog::Import::Wordpress::EntryParser
- Defined in:
- lib/workarea/blog/import/wordpress/entry_parser.rb
Instance Method Summary collapse
-
#initialize(doc) ⇒ EntryParser
constructor
A new instance of EntryParser.
- #parse ⇒ Object
Constructor Details
#initialize(doc) ⇒ EntryParser
Returns a new instance of EntryParser.
6 7 8 |
# File 'lib/workarea/blog/import/wordpress/entry_parser.rb', line 6 def initialize(doc) @posts = doc.xpath('//item[wp:post_type="post"]') end |
Instance Method Details
#parse ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/workarea/blog/import/wordpress/entry_parser.rb', line 10 def parse @posts.map do |post| { guid_path: guid_path(post), title: post_title(post), url: post_url(post), new_slug: File.basename(post_url(post)), published?: published?(post), published_date: published_date(post), tags: (post), author: Workarea.config.wordpress_import[:author_name], content: content(post), wordpress_hostname: wordpress_hostname(post) } end end |