<commit_before>module Blog
  module PostManager

    DELETE = 'Delete'
    SAVE = 'Save'

    def self.manage_post(params)
      save(params) if save_action?(params)
      delete(params) if delete_action?(params)
    end

    private
    def self.delete(params)
      DBAdapter.delete_post(params[:id])
    end

    def self.delete_action?(params)
      params[:action] == DELETE
    end

    def self.save(params)
      DBAdapter.new_post(params[:title], params[:body])
    end

    def self.save_action?(params)
      params[:action] == SAVE
    end
  end<commit_msg>PASS: Save action edit post<commit_after>module Blog
  module PostManager

    DELETE = 'Delete'
    SAVE = 'Save'

    def self.manage_post(params)
      save(params) if save_action?(params)
      delete(params) if delete_action?(params)
    end

    private
    def self.delete(params)
      DBAdapter.delete_post(params[:id])
    end

    def self.delete_action?(params)
      params[:action] == DELETE
    end

    def self.save(params)
      id = params[:id]
      if id == '' || id == nil then DBAdapter.new_post(params[:title], params[:body])
      else DBAdapter.edit_post(title: params[:title], body: params[:body])
      end
    end

    def self.save_action?(params)
      params[:action] == SAVE
    end
  end
{'fraction_non_alphanumeric': 0.11550387596899225, 'fraction_numerical': 0.0, 'mean_word_length': 2.8652694610778444, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5968730', 'n_tokens_mistral': 416, 'n_tokens_neox': 407, 'n_words': 92}