Class: Ods::File

Inherits:
Object
  • Object
show all
Defined in:
lib/ods/file.rb

Constant Summary collapse

XPATH_SHEETS =
'//office:body/office:spreadsheet/table:table'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ File



19
20
21
# File 'lib/ods/file.rb', line 19

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



17
18
19
# File 'lib/ods/file.rb', line 17

def path
  @path
end

Class Method Details

.open(path) ⇒ Object



8
9
10
11
12
13
14
15
# 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

Instance Method Details

#sheetsObject



23
24
25
# File 'lib/ods/file.rb', line 23

def sheets
  content.root.xpath(XPATH_SHEETS).map {|sheet| Sheet.new(sheet) }
end