Sha256: ef51d1b961842e0369012bd17d40a26b6da99147cf0b6428f9b1bfd1c97087d5

Contents?: true

Size: 378 Bytes

Versions: 13

Compression:

Stored size: 378 Bytes

Contents

class Pulitzer::CreateSingletonPost
  attr_accessor :post_type, :title

  def initialize(post_type)
    self.post_type = post_type
    self.title = post_type.name
  end

  def call
    if post_type.singular? && !post_type.posts.any?
      singleton_post = post_type.posts.create(title: title)
      Pulitzer::CreatePostContentElements.new(singleton_post).call
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
pulitzer-0.14.4 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.14.3 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.14.2 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.14.1 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.14.0 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.13.1 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.12.5 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.13.0 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.12.4 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.12.3 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.12.2 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.12.1 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.12.0 app/interactions/pulitzer/create_singleton_post.rb