Sha256: a94cb7925288fef52a8a42cb3743bee30c1df4dadf21f2ff7f9fa65150b4940d

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require 'fileutils'
require 'erb'

module RubySlides
  module Slide
    class Chart
      include RubySlides::Util

      attr_reader :title, :series

      def initialize(options={})
        require_arguments [:title, :series], options
        options.each {|k, v| instance_variable_set("@#{k}", v)}
      end

      def save(extract_path, index)
        save_rel_xml(extract_path, index)
        save_slide_xml(extract_path, index)
        save_chart_xml(extract_path, index)
      end

      def save_rel_xml(extract_path, index)
        render_view('chart_rel.xml.erb',
                    "#{extract_path}/ppt/slides/_rels/slide#{index}.xml.rels",
                    index: index)
      end
      private :save_rel_xml

      def save_slide_xml(extract_path, index)
        render_view('chart_slide.xml.erb',
                    "#{extract_path}/ppt/slides/slide#{index}.xml")
      end
      private :save_slide_xml

      def save_chart_xml(extract_path, index)
        render_view('chart_ele.xml.erb',
                    "#{extract_path}/ppt/charts/chart#{index}.xml")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby_slides-1.2.1 lib/ruby_slides/slide/chart.rb
ruby_slides-1.2.0 lib/ruby_slides/slide/chart.rb