Sha256: 266b4baf9304b6c90b69277609eb662255fc31f73e70d87fd0fe8a6552ec204e

Contents?: true

Size: 460 Bytes

Versions: 2

Compression:

Stored size: 460 Bytes

Contents

module Blogo
  # Creates new model of posts applying post params on it so it can be previewed.
  class PreviewPostService < BasePostService

    # @param user [Blogo::User]
    # @param params [Hash]
    def initialize(user, params)
      @post        = user.posts.build
      @post_attrs  = params
    end

    # Assign post attributes and return a post.
    #
    # @return [Blogo::Post]
    def preview
      assign_attributes
      @post
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blogo-0.1.1 app/services/blogo/preview_post_service.rb
blogo-0.1.0 app/services/blogo/preview_post_service.rb