class RestPki::PdfTextSection

Attributes

color[RW]
font_size[RW]
style[RW]
text[RW]

Public Class Methods

new(text=nil, color=nil, font_size=nil) click to toggle source
# File lib/rest_pki/pdf_text_section.rb, line 5
def initialize(text=nil, color=nil, font_size=nil)
  if color.nil?
    color = Color.from_rgb_string('#000000') # White
  end
  @style = PdfTextStyle::NORMAL
  @text = text
  @color = color
  @font_size = font_size
end

Public Instance Methods

bold() click to toggle source
# File lib/rest_pki/pdf_text_section.rb, line 40
def bold
  @style = PdfTextStyle::BOLD
  self
end
italic() click to toggle source
# File lib/rest_pki/pdf_text_section.rb, line 45
def italic
  @style = PdfTextStyle::ITALIC
  self
end
to_model() click to toggle source
# File lib/rest_pki/pdf_text_section.rb, line 15
def to_model
  color = nil
  unless @color.nil?
    color = @color
  end
  {
      style: @style,
      text: @text,
      color: color,
      fontSize: @font_size,
  }
end
with_color(color) click to toggle source
# File lib/rest_pki/pdf_text_section.rb, line 50
def with_color(color)
  @color = color
  self
end
with_font_size(font_size) click to toggle source

region FluentApi

# File lib/rest_pki/pdf_text_section.rb, line 30
def with_font_size(font_size)
  @font_size = font_size
  self
end
with_text(text) click to toggle source
# File lib/rest_pki/pdf_text_section.rb, line 35
def with_text(text)
  @text = text
  self
end