Class: OpenXml::Xlsx::Elements::Border

Inherits:
Object
  • Object
show all
Defined in:
lib/openxml/xlsx/elements/border.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Border

Returns a new instance of Border.



7
8
9
10
11
12
13
# File 'lib/openxml/xlsx/elements/border.rb', line 7

def initialize(options={})
  @left_component = options.fetch(:left, BorderComponent.new)
  @right_component = options.fetch(:right, BorderComponent.new)
  @top_component = options.fetch(:top, BorderComponent.new)
  @bottom_component = options.fetch(:bottom, BorderComponent.new)
  @diagonal_component = options.fetch(:diagonal, BorderComponent.new)
end

Instance Attribute Details

#bottom_componentObject (readonly)

Returns the value of attribute bottom_component.



5
6
7
# File 'lib/openxml/xlsx/elements/border.rb', line 5

def bottom_component
  @bottom_component
end

#diagonal_componentObject (readonly)

Returns the value of attribute diagonal_component.



5
6
7
# File 'lib/openxml/xlsx/elements/border.rb', line 5

def diagonal_component
  @diagonal_component
end

#left_componentObject (readonly)

Returns the value of attribute left_component.



5
6
7
# File 'lib/openxml/xlsx/elements/border.rb', line 5

def left_component
  @left_component
end

#right_componentObject (readonly)

Returns the value of attribute right_component.



5
6
7
# File 'lib/openxml/xlsx/elements/border.rb', line 5

def right_component
  @right_component
end

#top_componentObject (readonly)

Returns the value of attribute top_component.



5
6
7
# File 'lib/openxml/xlsx/elements/border.rb', line 5

def top_component
  @top_component
end

Instance Method Details

#to_xml(xml) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/openxml/xlsx/elements/border.rb', line 15

def to_xml(xml)
  xml.border do
    left_component.to_xml("left", xml)
    right_component.to_xml("right", xml)
    top_component.to_xml("top", xml)
    bottom_component.to_xml("bottom", xml)
    diagonal_component.to_xml("diagonal", xml)
  end
end