Class: Xlsxrb::Elements::RichText

Inherits:
Data
  • Object
show all
Defined in:
lib/xlsxrb/elements/types.rb,
sig/generated/xlsxrb/elements/types.rbs

Overview

Represents a rich text string with multiple formatting runs.

Examples:

rt = Elements::RichText.new(runs: [{ text: "Hello ", font: { bold: true } }, { text: "World" }])

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#runsObject (readonly)

Returns the value of attribute runs

Returns:

  • (Object)

    the current value of runs



62
63
64
# File 'lib/xlsxrb/elements/types.rb', line 62

def runs
  @runs
end

Class Method Details

.members[ :runs ]

Returns:

  • ([ :runs ])


77
# File 'sig/generated/xlsxrb/elements/types.rbs', line 77

def self.members: () -> [ :runs ]

.new(runs) ⇒ instance .new(runs:) ⇒ instance

Overloads:

  • .new(runs) ⇒ instance

    Parameters:

    • runs (Object)

    Returns:

    • (instance)
  • .new(runs:) ⇒ instance

    Parameters:

    • runs: (Object)

    Returns:

    • (instance)


74
75
# File 'sig/generated/xlsxrb/elements/types.rbs', line 74

def self.new: (untyped runs) -> instance
| (runs: untyped) -> instance

Instance Method Details

#members[ :runs ]

Returns:

  • ([ :runs ])


79
# File 'sig/generated/xlsxrb/elements/types.rbs', line 79

def members: () -> [ :runs ]

#to_sString

Returns concatenated plain text of all runs.

Signature:

  • () -> String

Returns:

  • (String)


68
69
70
# File 'lib/xlsxrb/elements/types.rb', line 68

def to_s
  runs.map { |r| r[:text] }.join
end