class Ernest::CreatesDrafts

Attributes

file_path[R]
post_class[R]
response_handler[R]

Public Class Methods

new(file_path, response_handler = UpdatePostId, post_class = Post) click to toggle source
# File lib/ernest.rb, line 7
def initialize(file_path, response_handler = UpdatePostId, post_class = Post)
  @file_path = file_path
  @response_handler = response_handler
  @post_class = post_class
end

Public Instance Methods

call() click to toggle source
# File lib/ernest.rb, line 13
def call
  response = post.save
  response_handler.after_saving_post(response, post).call
end

Private Instance Methods

post() click to toggle source
# File lib/ernest.rb, line 22
def post
  @_post ||= post_class.parse_from_file(file_path)
end