class BerkeleyLibrary::Util::ODS::XML::Style::Style

Attributes

family[R]
style_name[R]

Public Class Methods

new(style_name, family, doc:) click to toggle source
# File lib/berkeley_library/util/ods/xml/style/style.rb, line 14
def initialize(style_name, family, doc:)
  super(:style, 'style', doc: doc)

  @style_name = style_name
  @family = Family.ensure_family(family)

  set_default_attributes!
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/berkeley_library/util/ods/xml/style/style.rb, line 23
def <=>(other)
  return 0 if other.equal?(self)
  return nil unless other.instance_of?(self.class)

  s_index, o_index = [style_name, other.style_name].map { |n| family.index_part(n) }
  return style_name <=> other.style_name unless s_index && o_index

  s_index <=> o_index
end

Private Instance Methods

set_default_attributes!() click to toggle source
# File lib/berkeley_library/util/ods/xml/style/style.rb, line 35
def set_default_attributes!
  set_attribute('name', style_name)
  set_attribute('family', family)
end