Class: Workbook

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(twbWithDir) ⇒ Workbook

Returns a new instance of Workbook.



17
18
19
20
21
22
23
24
25
# File 'lib/tableauworkbook.rb', line 17

def initialize twbWithDir
  file     = File.new(twbWithDir)
  @name    = File.basename(twbWithDir)
  @dir     = File.dirname(File.expand_path(twbWithDir))
  @modtime = File.new(twbWithDir).mtime
  @ndoc = Nokogiri::XML(open(twbWithDir))
  @version = @ndoc.xpath('/workbook/@version')
  @build   = @ndoc.xpath('/workbook/comment()').text.gsub(/^[^0-9]+/,'').strip
end

Instance Attribute Details

#buildObject (readonly)

Returns the value of attribute build.



15
16
17
# File 'lib/tableauworkbook.rb', line 15

def build
  @build
end

#dirObject (readonly)

Returns the value of attribute dir.



15
16
17
# File 'lib/tableauworkbook.rb', line 15

def dir
  @dir
end

#modtimeObject (readonly)

Returns the value of attribute modtime.



15
16
17
# File 'lib/tableauworkbook.rb', line 15

def modtime
  @modtime
end

#nameObject (readonly)

Returns the value of attribute name.



15
16
17
# File 'lib/tableauworkbook.rb', line 15

def name
  @name
end

#ndocObject (readonly)

Returns the value of attribute ndoc.



15
16
17
# File 'lib/tableauworkbook.rb', line 15

def ndoc
  @ndoc
end

#versionObject (readonly)

Returns the value of attribute version.



15
16
17
# File 'lib/tableauworkbook.rb', line 15

def version
  @version
end