Class: Axlsx::StrVal

Inherits:
Object
  • Object
show all
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

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)


13
14
15
16
17
18
19
# File 'lib/axlsx/drawing/str_val.rb', line 13

def initialize(options={})
  @v = ""
  @idx = 0
  options.each do |o|
    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
  end
end

Instance Attribute Details

#vString

a string value.

Returns:

  • (String)


9
10
11
# File 'lib/axlsx/drawing/str_val.rb', line 9

def v
  @v
end

Instance Method Details

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

serialize the object



26
27
28
29
# File 'lib/axlsx/drawing/str_val.rb', line 26

def to_xml_string(idx, str = "")
  Axlsx::validate_unsigned_int(idx)
  str << '<c:pt idx="' << idx.to_s << '"><c:v>' << v.to_s << '</c:v></c:pt>'
end