Class: WordpressImport::About

Inherits:
Object
  • Object
show all
Defined in:
lib/wordpress_import/about.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ About

Returns a new instance of About.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/wordpress_import/about.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

  @title = node.xpath('title').first.content
  @content = node.xpath('content:encoded').first.content
  @excerpt = node.xpath('excerpt:encoded').first.content

  @meta = {}
  node.xpath('wp:postmeta').each do ||
    @meta[.xpath('wp:meta_key').first.content] = .xpath('wp:meta_value').first.content
  end
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



3
4
5
# File 'lib/wordpress_import/about.rb', line 3

def content
  @content
end

#creatorObject

Returns the value of attribute creator.



3
4
5
# File 'lib/wordpress_import/about.rb', line 3

def creator
  @creator
end

#dateObject

Returns the value of attribute date.



3
4
5
# File 'lib/wordpress_import/about.rb', line 3

def date
  @date
end

#excerptObject

Returns the value of attribute excerpt.



3
4
5
# File 'lib/wordpress_import/about.rb', line 3

def excerpt
  @excerpt
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/wordpress_import/about.rb', line 3

def id
  @id
end

Returns the value of attribute link.



3
4
5
# File 'lib/wordpress_import/about.rb', line 3

def link
  @link
end

#metaObject

Returns the value of attribute meta.



3
4
5
# File 'lib/wordpress_import/about.rb', line 3

def meta
  @meta
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/wordpress_import/about.rb', line 3

def name
  @name
end

#parentObject

Returns the value of attribute parent.



3
4
5
# File 'lib/wordpress_import/about.rb', line 3

def parent
  @parent
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/wordpress_import/about.rb', line 3

def title
  @title
end