Class: Wordpress::WXR::Category

Inherits:
Element
  • Object
show all
Defined in:
lib/wordpress/wxr/category.rb

Instance Method Summary collapse

Methods inherited from Element

#initialize

Constructor Details

This class inherits a constructor from Wordpress::WXR::Element

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



22
23
24
25
# File 'lib/wordpress/wxr/category.rb', line 22

def ==(other)
  self.class == other.class &&
    id == other.id
end

#idObject



6
7
8
# File 'lib/wordpress/wxr/category.rb', line 6

def id
  Integer(node.xpath('wp:term_id').text)
end

#nameObject



18
19
20
# File 'lib/wordpress/wxr/category.rb', line 18

def name
  node.xpath('wp:cat_name').text
end

#nicenameObject



10
11
12
# File 'lib/wordpress/wxr/category.rb', line 10

def nicename
  node.xpath('wp:category_nicename').text
end

#parentObject



14
15
16
# File 'lib/wordpress/wxr/category.rb', line 14

def parent
  wxr.categories.find_by(nicename: node.xpath('wp:category_parent').text)
end