Class: Axlsx::StrVal

Inherits:
Object
  • Object
show all
Includes:
OptionsParser
Defined in:
lib/axlsx/drawing/str_val.rb

Overview

This class specifies data for a particular data point.

Direct Known Subclasses

NumVal

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OptionsParser

#parse_options

Constructor Details

#initialize(options = {}) ⇒ StrVal

creates a new StrVal object

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • v (String)


11
12
13
14
15
# File 'lib/axlsx/drawing/str_val.rb', line 11

def initialize(options={})
  @v = ""
  @idx = 0
  parse_options options
end

Instance Attribute Details

#vString

a string value.

Returns:

  • (String)


19
20
21
# File 'lib/axlsx/drawing/str_val.rb', line 19

def v
  @v
end

Instance Method Details

#to_xml_string(idx, str = "") ⇒ Object

serialize the object



27
28
29
30
31
32
# File 'lib/axlsx/drawing/str_val.rb', line 27

def to_xml_string(idx, str = "")
  Axlsx::validate_unsigned_int(idx)
  if !v.to_s.empty?
    str << ('<c:pt idx="' << idx.to_s << '"><c:v>' << ::CGI.escapeHTML(v.to_s) << '</c:v></c:pt>')
  end
end