Sha256: 6f5de27706b41a98d1a2d93774c71ac50b455e6eaf1d1af50624ec3fd22b87cc
Contents?: true
Size: 1.28 KB
Versions: 4
Compression:
Stored size: 1.28 KB
Contents
module Axlsx # Base class for xVal, yVal and val and cat data sources # @note xVal and cat are AxDataSource elements while yVal and val are NumDataSource elements # The difference being that with AxDataSource elements, the data can be numLit, numRef, strLit or strRef # while NumDataSource elements can only be numLit or numRef class DataSource def self.allowed_tag_names [:yVal, :xVal, :val, :cat] end def self.allowed_types [NumData, StrData] end attr_reader :tag_name attr_reader :data def initialize(type, data=[], options={}) Axlsx::RestrictionValidator.validate "#{self.class.name}", self.class.allowed_types, type @data = type.new(:data = data) tag_name = :val options.each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end def tag_name=(v) Axlsx::RestrictionValidator.validate "#{self.class.name}.tag_name", self.class.allowed_tag_names, v @tag_name = v end def f is_reference? ? Axlsx::cell_range(data) : '' end def is_reference? @data.first.is_a? Cell end def to_xml_string(str = '') str << '<c:' << tag_name.to_s << '>' @data.to_xml_string str str << '</c:' << tag_name.to_s << '>' end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
axlsx-1.1.7 | lib/axlsx/drawing/data_source.rb~ |
axlsx-1.1.6 | lib/axlsx/drawing/data_source.rb~ |
axlsx-1.1.5 | lib/axlsx/drawing/data_source.rb~ |
axlsx-1.1.4 | lib/axlsx/drawing/data_source.rb~ |