Class: WordpressImport::Attachment
- Inherits:
-
Object
- Object
- WordpressImport::Attachment
- Defined in:
- lib/wordpress_import/attachment.rb
Instance Attribute Summary collapse
-
#creator ⇒ Object
Returns the value of attribute creator.
-
#date ⇒ Object
Returns the value of attribute date.
-
#id ⇒ Object
Returns the value of attribute id.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(node) ⇒ Attachment
constructor
A new instance of Attachment.
Constructor Details
#initialize(node) ⇒ Attachment
Returns a new instance of Attachment.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/wordpress_import/attachment.rb', line 5 def initialize(node) @id = node.xpath('wp:post_id').first.content.to_i @parent = node.xpath('wp:post_parent').first.content @url = node.xpath('wp:attachment_url').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 = {} node.xpath('wp:postmeta').each do || [.xpath('wp:meta_key').first.content] = .xpath('wp:meta_value').first.content end end |
Instance Attribute Details
#creator ⇒ Object
Returns the value of attribute creator.
3 4 5 |
# File 'lib/wordpress_import/attachment.rb', line 3 def creator @creator end |
#date ⇒ Object
Returns the value of attribute date.
3 4 5 |
# File 'lib/wordpress_import/attachment.rb', line 3 def date @date end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/wordpress_import/attachment.rb', line 3 def id @id end |
#meta ⇒ Object
Returns the value of attribute meta.
3 4 5 |
# File 'lib/wordpress_import/attachment.rb', line 3 def end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/wordpress_import/attachment.rb', line 3 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
3 4 5 |
# File 'lib/wordpress_import/attachment.rb', line 3 def parent @parent end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/wordpress_import/attachment.rb', line 3 def url @url end |