class Ods::File

Constants

XPATH_SHEETS

Attributes

path[R]

Public Class Methods

new(path) click to toggle source
# File lib/ods/file.rb, line 19
def initialize(path)
  @path = path
end
open(path) { |ods_file| ... } click to toggle source
# File lib/ods/file.rb, line 8
def self.open(path)
  ods_file = new(path)
  if block_given?
    yield ods_file
  else
    ods_file
  end
end

Public Instance Methods

sheets() click to toggle source
# File lib/ods/file.rb, line 23
def sheets
  content.root.xpath(XPATH_SHEETS).map {|sheet| Sheet.new(sheet) }
end

Private Instance Methods

content() click to toggle source
# File lib/ods/file.rb, line 29
def content
  @content ||= unzip_content
end
unzip_content() click to toggle source
# File lib/ods/file.rb, line 33
def unzip_content
  Zip::ZipFile.open(path) do |zip|
    Nokogiri::XML::Document.parse(zip.read('content.xml'))
  end
end