Class: WordpressImport::Post
- Inherits:
-
Object
- Object
- WordpressImport::Post
- Defined in:
- lib/wordpress_import/post.rb
Instance Attribute Summary collapse
-
#categories ⇒ Object
Returns the value of attribute categories.
-
#content ⇒ Object
Returns the value of attribute content.
-
#creator ⇒ Object
Returns the value of attribute creator.
-
#date ⇒ Object
Returns the value of attribute date.
-
#excerpt ⇒ Object
Returns the value of attribute excerpt.
-
#id ⇒ Object
Returns the value of attribute id.
-
#link ⇒ Object
Returns the value of attribute link.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#status ⇒ Object
Returns the value of attribute status.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(node) ⇒ Post
constructor
A new instance of Post.
Constructor Details
#initialize(node) ⇒ Post
Returns a new instance of Post.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/wordpress_import/post.rb', line 5 def initialize(node) @id = node.xpath('wp:post_id').first.content @parent = node.xpath('wp:post_parent').first.content @link = node.xpath('link').first.content @date = node.xpath('wp:post_date').first.content @creator = node.xpath('dc:creator').first.content @name = node.xpath('wp:post_name').first.content @status = node.xpath('wp:status').first.content @title = node.xpath('title').first.content @content = node.xpath('content:encoded').first.content @excerpt = node.xpath('excerpt:encoded').first.content = node.xpath('category[@domain="post_tag"]').map { |t| t.attr('nicename') } @categories = node.xpath('category[@domain="category"]').map { |t| t.attr('nicename') } = {} node.xpath('wp:postmeta').each do || [.xpath('wp:meta_key').first.content] = .xpath('wp:meta_value').first.content end end |
Instance Attribute Details
#categories ⇒ Object
Returns the value of attribute categories.
3 4 5 |
# File 'lib/wordpress_import/post.rb', line 3 def categories @categories end |
#content ⇒ Object
Returns the value of attribute content.
3 4 5 |
# File 'lib/wordpress_import/post.rb', line 3 def content @content end |
#creator ⇒ Object
Returns the value of attribute creator.
3 4 5 |
# File 'lib/wordpress_import/post.rb', line 3 def creator @creator end |
#date ⇒ Object
Returns the value of attribute date.
3 4 5 |
# File 'lib/wordpress_import/post.rb', line 3 def date @date end |
#excerpt ⇒ Object
Returns the value of attribute excerpt.
3 4 5 |
# File 'lib/wordpress_import/post.rb', line 3 def excerpt @excerpt end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/wordpress_import/post.rb', line 3 def id @id end |
#link ⇒ Object
Returns the value of attribute link.
3 4 5 |
# File 'lib/wordpress_import/post.rb', line 3 def link @link end |
#meta ⇒ Object
Returns the value of attribute meta.
3 4 5 |
# File 'lib/wordpress_import/post.rb', line 3 def end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/wordpress_import/post.rb', line 3 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
3 4 5 |
# File 'lib/wordpress_import/post.rb', line 3 def parent @parent end |
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'lib/wordpress_import/post.rb', line 3 def status @status end |
#tags ⇒ Object
Returns the value of attribute tags.
3 4 5 |
# File 'lib/wordpress_import/post.rb', line 3 def end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/wordpress_import/post.rb', line 3 def title @title end |