Class: BerkeleyLibrary::Util::ODS::XML::Style::Style
- Inherits:
-
ElementNode
- Object
- ElementNode
- BerkeleyLibrary::Util::ODS::XML::Style::Style
- Includes:
- Comparable
- Defined in:
- lib/berkeley_library/util/ods/xml/style/style.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#family ⇒ Object
readonly
Returns the value of attribute family.
-
#style_name ⇒ Object
readonly
Returns the value of attribute style_name.
Attributes inherited from ElementNode
#doc, #element_name, #namespace
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(style_name, family, doc:) ⇒ Style
constructor
A new instance of 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(style_name, family, doc:) ⇒ Style
Returns a new instance of Style.
14 15 16 17 18 19 20 21 |
# 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 |
Instance Attribute Details
#family ⇒ Object (readonly)
Returns the value of attribute family.
12 13 14 |
# File 'lib/berkeley_library/util/ods/xml/style/style.rb', line 12 def family @family end |
#style_name ⇒ Object (readonly)
Returns the value of attribute style_name.
12 13 14 |
# File 'lib/berkeley_library/util/ods/xml/style/style.rb', line 12 def style_name @style_name end |
Instance Method Details
#<=>(other) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# 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 |