Class: BerkeleyLibrary::Util::ODS::XML::Style::TextProperties

Inherits:
ElementNode
  • Object
show all
Defined in:
lib/berkeley_library/util/ods/xml/style/text_properties.rb

Constant Summary collapse

FONT_WEIGHT_ATTRS =
%w[font-weight font-weight-asian font-weight-complex].freeze
COLOR_RE =
/^#[[:xdigit:]]{6}$/.freeze

Instance Attribute Summary collapse

Attributes inherited from ElementNode

#doc, #element_name, #namespace

Instance Method Summary collapse

Methods inherited from ElementNode

#add_child, #attributes, #children, #clear_attribute, #create_element, #element, #ensure_element!, #prefix, #prefixed_attr_name, #set_attribute

Constructor Details

#initialize(color: nil, font_name: nil, font_weight: nil, language: 'en', country: 'US', doc:) ⇒ TextProperties

rubocop:disable Metrics/ParameterLists, Style/KeywordParametersOrder



16
17
18
19
20
21
22
23
24
# File 'lib/berkeley_library/util/ods/xml/style/text_properties.rb', line 16

def initialize(color: nil, font_name: nil, font_weight: nil, language: 'en', country: 'US', doc:)
  super(:style, 'text-properties', doc: doc)
  @color = ensure_color(color)
  @font_name = font_name
  @language = language
  @country = country
  @font_weight = font_weight
  set_default_attributes!
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



13
14
15
# File 'lib/berkeley_library/util/ods/xml/style/text_properties.rb', line 13

def color
  @color
end

#countryObject (readonly)

Returns the value of attribute country.



13
14
15
# File 'lib/berkeley_library/util/ods/xml/style/text_properties.rb', line 13

def country
  @country
end

#font_nameObject (readonly)

Returns the value of attribute font_name.



13
14
15
# File 'lib/berkeley_library/util/ods/xml/style/text_properties.rb', line 13

def font_name
  @font_name
end

#font_weightObject (readonly)

Returns the value of attribute font_weight.



13
14
15
# File 'lib/berkeley_library/util/ods/xml/style/text_properties.rb', line 13

def font_weight
  @font_weight
end

#languageObject (readonly)

Returns the value of attribute language.



13
14
15
# File 'lib/berkeley_library/util/ods/xml/style/text_properties.rb', line 13

def language
  @language
end