class Vym::MindMap

Attributes

hash_content[R]

Public Class Methods

from(org_text: nil, **options) click to toggle source
# File lib/vym/mind_map.rb, line 14
def self.from(org_text: nil, **options)
  new(OrgParser.new(org_text).to_h)
end
from_org_file(file_name) click to toggle source
# File lib/vym/mind_map.rb, line 18
def self.from_org_file(file_name)
  new(OrgParser.new(File.read(file_name)).to_h)
end
new(hash_content) click to toggle source
# File lib/vym/mind_map.rb, line 10
def initialize(hash_content)
  @hash_content = hash_content
end

Public Instance Methods

to_file(file_name) click to toggle source
# File lib/vym/mind_map.rb, line 26
def to_file(file_name)
  file_path = Pathname(file_name).expand_path
  Zip::File.open(file_path.to_s, Zip::File::CREATE) do |zipfile|
    zipfile.get_output_stream(file_path.basename(".vym").to_s + ".xml") { |os|
      os.write xml
    }
  end
  puts "Created #{file_path}"
end
xml() click to toggle source
# File lib/vym/mind_map.rb, line 22
def xml
  HashToXmlMap.new(hash_content).render
end