Sha256: 9fcabc1c5ee8e2eb287711b317bde8901451924072c4ea6de2e46fb32708bd98

Contents?: true

Size: 1.63 KB

Versions: 38

Compression:

Stored size: 1.63 KB

Contents

# -*- coding: utf-8 -*-
###############################################################################
#
# External - A writer class for Excel external charts.
#
# Used in conjunction with WriteExcel
#
# perltidy with options: -mbl=2 -pt=0 -nola
#
# Copyright 2000-2010, John McNamara, jmcnamara@cpan.org
#
# original written in Perl by John McNamara
# converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
#

require 'writeexcel/chart'

module Writeexcel

class External < Chart # :nodoc:
  ###############################################################################
  #
  # new()
  #
  def initialize(external_filename, *args)
    super(*args)

    @filename     = external_filename
    @external_bin = true

    _initialize    # Requires overridden initialize().
    self
  end

  ###############################################################################
  #
  # _initialize()
  #
  # Read all the data into memory for the external binary style chart.
  #
  def _initialize
    filename   = @filename
    filehandle = File.open(filename, 'rb')

    @filehandle    = filehandle
    @datasize      = FileTest.size(filename)
    @using_tmpfile = false

    # Read the entire external chart binary into the the data buffer.
    # This will be retrieved by _get_data() when the chart is closed().
    @data = @filehandle.read(@datasize)
  end

  ###############################################################################
  #
  # _close()
  #
  # We don't need to create or store Chart data structures when using an
  # external binary, so we have a default close method.
  #
  def close
    nil
  end
end  # class Chart

end  # module Writeexcel

Version data entries

38 entries across 38 versions & 3 rubygems

Version Path
writeexcel-1.0.9 lib/writeexcel/charts/external.rb
writeexcel-1.0.8 lib/writeexcel/charts/external.rb
writeexcel-1.0.7 lib/writeexcel/charts/external.rb
writeexcel-1.0.6 lib/writeexcel/charts/external.rb
writeexcel-1.0.5 lib/writeexcel/charts/external.rb
writeexcel-1.0.4 lib/writeexcel/charts/external.rb
writeexcel-1.0.3 lib/writeexcel/charts/external.rb
writeexcel-1.0.2 lib/writeexcel/charts/external.rb
writeexcel-1.0.1 lib/writeexcel/charts/external.rb
writeexcel-1.0.0 lib/writeexcel/charts/external.rb
writeexcel-0.6.19 lib/writeexcel/charts/external.rb
writeexcel-0.6.18 lib/writeexcel/charts/external.rb
writeexcel-0.6.17 lib/writeexcel/charts/external.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/writeexcel-0.6.16/lib/writeexcel/charts/external.rb
writeexcel-0.6.16 lib/writeexcel/charts/external.rb
writeexcel-0.6.15 lib/writeexcel/charts/external.rb
writeexcel-0.6.14 lib/writeexcel/charts/external.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/writeexcel-0.6.13/lib/writeexcel/charts/external.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/writeexcel-0.6.13/lib/writeexcel/charts/external.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/writeexcel-0.6.13/lib/writeexcel/charts/external.rb