Sha256: 527767761ea8816c7b3caf98510780fb00735a02655bb69325090e834c429a8b

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

# -*- coding: utf-8 -*-
module Axlsx

  #This class specifies data for a particular data point.
  class NumVal < StrVal

    # A string representing the format code to apply. For more information see see the SpreadsheetML numFmt element's (ยง18.8.30) formatCode attribute.
    # @return [String]
    attr_reader :format_code

    # creates a new NumVal object
    # @option options [String] formatCode
    # @option options [Integer] v
    def initialize(options={})
      @format_code = "General"
      @v = @idx = 0
      options.each do |o|
        self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
      end
    end

    # @see format_code
    def format_code=(v='General')
      Axlsx::validate_string(v)
      @format_code = v
    end

    # @see v
    def v=(v)
      Axlsx::validate_int(v)
      @v = v
    end

    # serialize the object
    def to_xml_string(idx, str = "")
      Axlsx::validate_unsigned_int(idx)
      str << '<c:pt idx="' << idx.to_s << '" formatCode="' << format_code << '"><c:v>' << v.to_s << '</c:v></c:pt>'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
axlsx-1.1.7 lib/axlsx/drawing/num_val.rb~
axlsx-1.1.6 lib/axlsx/drawing/num_val.rb~
axlsx-1.1.5 lib/axlsx/drawing/num_val.rb~
axlsx-1.1.4 lib/axlsx/drawing/num_val.rb~