Class: WP2Middleman::PostCollection
- Inherits:
-
Object
- Object
- WP2Middleman::PostCollection
- Defined in:
- lib/wp2middleman/post_collection.rb
Instance Method Summary collapse
-
#initialize(wp_xml_export_file) ⇒ PostCollection
constructor
A new instance of PostCollection.
- #posts ⇒ Object
Constructor Details
#initialize(wp_xml_export_file) ⇒ PostCollection
Returns a new instance of PostCollection.
5 6 7 |
# File 'lib/wp2middleman/post_collection.rb', line 5 def initialize(wp_xml_export_file) @xml = Nokogiri::XML(File.open("#{Dir.pwd}/#{wp_xml_export_file}")) end |
Instance Method Details
#posts ⇒ Object
9 10 11 12 13 |
# File 'lib/wp2middleman/post_collection.rb', line 9 def posts @xml.css('item') .map { |post| WP2Middleman::Post.new(post) } .reject { |post| post.type == 'attachment' } end |