Sha256: 2108cb698536bde62d6693f441d33dc87d62757c3ce5c3387f371d476f1cf3bd
Contents?: true
Size: 612 Bytes
Versions: 1
Compression:
Stored size: 612 Bytes
Contents
require "mtif/version" require "mtif/posts" # Based on https://movabletype.org/documentation/appendices/import-export-format.html class MTIF attr_accessor :posts def initialize(content) @posts = content.slice_after(/^--------$/).map {|raw_post| MTIF::Post.new(raw_post)} end def self.load_file(filename) mtif_file = File.open(filename) mtif = MTIF.new(mtif_file.readlines) mtif_file.close mtif end def to_mtif posts.map(&:to_mtif).join end def save_file(filename) mtif_file = File.open(filename, 'w') mtif_file << self.to_mtif mtif_file.close end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mtif-0.0.2 | lib/mtif.rb |