Class: XlsxWriter::HeaderFooter::HF

Inherits:
Object
  • Object
show all
Defined in:
lib/xlsx_writer/header_footer.rb

Defined Under Namespace

Classes: LCR

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, tag) ⇒ HF

Returns a new instance of HF.



30
31
32
33
34
35
36
# File 'lib/xlsx_writer/header_footer.rb', line 30

def initialize(id, tag)
  @id = id
  @tag = tag
  @left = LCR.new self, 'L'
  @center = LCR.new self, 'C'
  @right = LCR.new self, 'R'
end

Instance Attribute Details

#centerObject (readonly)

Returns the value of attribute center.



27
28
29
# File 'lib/xlsx_writer/header_footer.rb', line 27

def center
  @center
end

#idObject (readonly)

Returns the value of attribute id.



24
25
26
# File 'lib/xlsx_writer/header_footer.rb', line 24

def id
  @id
end

#leftObject (readonly)

Returns the value of attribute left.



26
27
28
# File 'lib/xlsx_writer/header_footer.rb', line 26

def left
  @left
end

#rightObject (readonly)

Returns the value of attribute right.



28
29
30
# File 'lib/xlsx_writer/header_footer.rb', line 28

def right
  @right
end

#tagObject (readonly)

Returns the value of attribute tag.



25
26
27
# File 'lib/xlsx_writer/header_footer.rb', line 25

def tag
  @tag
end

Instance Method Details

#has_image?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/xlsx_writer/header_footer.rb', line 46

def has_image?
  parts.any?(&:has_image?)
end

#partsObject



42
43
44
# File 'lib/xlsx_writer/header_footer.rb', line 42

def parts
  [left,center,right].select(&:present?)
end

#to_xmlObject



38
39
40
# File 'lib/xlsx_writer/header_footer.rb', line 38

def to_xml
  %{<#{tag}>#{parts.map(&:code).join}</#{tag}>}
end