Class: BerkeleyLibrary::Util::ODS::XML::Style::CellStyle
- Inherits:
-
Style
- Object
- ElementNode
- Style
- BerkeleyLibrary::Util::ODS::XML::Style::CellStyle
- Defined in:
- lib/berkeley_library/util/ods/xml/style/cell_style.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#font_weight ⇒ Object
readonly
Returns the value of attribute font_weight.
Attributes inherited from Style
Attributes inherited from ElementNode
#doc, #element_name, #namespace
Instance Method Summary collapse
- #custom_text_properties? ⇒ Boolean
-
#initialize(name, protected = false, color = nil, styles:, font_weight: nil, wrap: false) ⇒ CellStyle
constructor
Initializes a new cell style.
-
#protected? ⇒ Boolean
rubocop:enable Metrics/ParameterLists, Style/OptionalBooleanParameter.
- #wrap? ⇒ Boolean
Methods inherited from Style
Methods inherited from ElementNode
#add_child, #attributes, #children, #clear_attribute, #create_element, #element, #ensure_element!, #prefix, #prefixed_attr_name, #set_attribute
Constructor Details
#initialize(name, protected = false, color = nil, styles:, font_weight: nil, wrap: false) ⇒ CellStyle
Initializes a new cell style. Note that this should not be called directly, but only from Office::AutomaticStyles#add_cell_style.
rubocop:disable Metrics/ParameterLists, Style/OptionalBooleanParameter
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/berkeley_library/util/ods/xml/style/cell_style.rb', line 23 def initialize(name, protected = false, color = nil, styles:, font_weight: nil, wrap: false) super(name, :table_cell, doc: styles.doc) @protected = protected @color = color @font_weight = font_weight @wrap = wrap set_attribute('parent-style-name', 'Default') add_default_children! end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
12 13 14 |
# File 'lib/berkeley_library/util/ods/xml/style/cell_style.rb', line 12 def color @color end |
#font_weight ⇒ Object (readonly)
Returns the value of attribute font_weight.
12 13 14 |
# File 'lib/berkeley_library/util/ods/xml/style/cell_style.rb', line 12 def font_weight @font_weight end |
Instance Method Details
#custom_text_properties? ⇒ Boolean
43 44 45 |
# File 'lib/berkeley_library/util/ods/xml/style/cell_style.rb', line 43 def custom_text_properties? [color, font_weight].any? { |p| !p.nil? } end |
#protected? ⇒ Boolean
rubocop:enable Metrics/ParameterLists, Style/OptionalBooleanParameter
35 36 37 |
# File 'lib/berkeley_library/util/ods/xml/style/cell_style.rb', line 35 def protected? @protected end |
#wrap? ⇒ Boolean
39 40 41 |
# File 'lib/berkeley_library/util/ods/xml/style/cell_style.rb', line 39 def wrap? @wrap end |