Module: Crek::Utils

Included in:
Drawing, Sheet
Defined in:
lib/crek/utils.rb

Instance Method Summary collapse

Instance Method Details

#expand_to_rels_path(filepath) ⇒ Object



3
4
5
# File 'lib/crek/utils.rb', line 3

def expand_to_rels_path(filepath)
  filepath.sub(/(\/[^\/]+$)/, '/_rels\1.rels')
end

#file_exist?(path) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/crek/utils.rb', line 7

def file_exist?(path)
  @book.files.file.exist?(path)
end

#parse_xml(xml_path) ⇒ Object



11
12
13
14
# File 'lib/crek/utils.rb', line 11

def parse_xml(xml_path)
  doc = @book.files.file.open(xml_path)
  Nokogiri::XML::Document.parse(doc)
end