Class: Contentful::Exporter::Wordpress::PostCategoryDomain
- Defined in:
- lib/wordpress/post_category_domain.rb
Instance Attribute Summary collapse
-
#post ⇒ Object
readonly
Returns the value of attribute post.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Instance Method Summary collapse
- #extract_categories ⇒ Object
- #extract_tags ⇒ Object
-
#initialize(xml, post, settings) ⇒ PostCategoryDomain
constructor
A new instance of PostCategoryDomain.
Methods inherited from Post
Methods inherited from Blog
#blog_extractor, #create_directory, #link_asset, #link_entry, #output_logger, #write_json_to_file
Constructor Details
#initialize(xml, post, settings) ⇒ PostCategoryDomain
Returns a new instance of PostCategoryDomain.
9 10 11 12 13 |
# File 'lib/wordpress/post_category_domain.rb', line 9 def initialize(xml, post, settings) @xml = xml @post = post @settings = settings end |
Instance Attribute Details
#post ⇒ Object (readonly)
Returns the value of attribute post.
7 8 9 |
# File 'lib/wordpress/post_category_domain.rb', line 7 def post @post end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
7 8 9 |
# File 'lib/wordpress/post_category_domain.rb', line 7 def settings @settings end |
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
7 8 9 |
# File 'lib/wordpress/post_category_domain.rb', line 7 def xml @xml end |
Instance Method Details
#extract_categories ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/wordpress/post_category_domain.rb', line 23 def extract_categories output_logger.info 'Extracting post categories...' post_domains('category[domain=category]').each_with_object([]) do |category, categories| normalized_categories = normalized_data(category, '//wp:category') categories << normalized_categories unless normalized_categories.empty? end end |
#extract_tags ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/wordpress/post_category_domain.rb', line 15 def output_logger.info 'Extracting post tags...' post_domains('category[domain=post_tag]').each_with_object([]) do |tag, | normalized_tag = normalized_data(tag, '//wp:tag') << normalized_tag unless normalized_tag.empty? end end |