Class: Pidgin2Adium::AdiumChatFileCreator

Inherits:
Object
  • Object
show all
Defined in:
lib/pidgin2adium/adium_chat_file_creator.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_path, aliases, output_directory = Runner::ADIUM_LOG_DIRECTORY) ⇒ AdiumChatFileCreator

Returns a new instance of AdiumChatFileCreator


3
4
5
6
7
# File 'lib/pidgin2adium/adium_chat_file_creator.rb', line 3

def initialize(file_path, aliases, output_directory = Runner::ADIUM_LOG_DIRECTORY)
  @file_path = file_path
  @aliases = aliases
  @output_directory = Pathname.new(output_directory.to_s)
end

Instance Method Details

#createObject


9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pidgin2adium/adium_chat_file_creator.rb', line 9

def create
  if chat
    create_containing_directory
    File.open(path, 'w') do |file|
      file.puts xml_prolog
      file.puts opening_chat_tag
      file.puts chat.to_s
      file.puts closing_chat_tag
    end
    true
  else
    false
  end
end