class MTIF

Based on movabletype.org/documentation/appendices/import-export-format.html

Constants

VERSION

Attributes

posts[RW]

Public Class Methods

load_file(filename) click to toggle source
# File lib/mtif.rb, line 13
def self.load_file(filename)
  mtif_file = File.open(filename)
  mtif = MTIF.new(mtif_file.readlines)
  mtif_file.close

  mtif
end
new(content) click to toggle source
# File lib/mtif.rb, line 9
def initialize(content)
  @posts = content.slice_after(/^--------$/).map {|raw_post| MTIF::Post.new(raw_post)}
end

Public Instance Methods

save_file(filename) click to toggle source
# File lib/mtif.rb, line 25
def save_file(filename)
  mtif_file = File.open(filename, 'w')
  mtif_file << self.to_mtif
  mtif_file.close
end
to_mtif() click to toggle source
# File lib/mtif.rb, line 21
def to_mtif
  posts.map(&:to_mtif).join
end