Class: OoxmlParser::StyleParametres
- Inherits:
-
Object
- Object
- OoxmlParser::StyleParametres
- Defined in:
- lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/style_parametres.rb
Instance Attribute Summary collapse
-
#hidden ⇒ Object
Returns the value of attribute hidden.
-
#name ⇒ Object
Returns the value of attribute name.
-
#q_format ⇒ Object
Returns the value of attribute q_format.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name = nil, q_format = false, hidden = false) ⇒ StyleParametres
constructor
A new instance of StyleParametres.
Constructor Details
#initialize(name = nil, q_format = false, hidden = false) ⇒ StyleParametres
Returns a new instance of StyleParametres.
6 7 8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/style_parametres.rb', line 6 def initialize(name = nil, q_format = false, hidden = false) @name = name @q_format = q_format @hidden = hidden end |
Instance Attribute Details
#hidden ⇒ Object
Returns the value of attribute hidden.
4 5 6 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/style_parametres.rb', line 4 def hidden @hidden end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/style_parametres.rb', line 4 def name @name end |
#q_format ⇒ Object
Returns the value of attribute q_format.
4 5 6 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/style_parametres.rb', line 4 def q_format @q_format end |
Class Method Details
.parse(style_tag) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/style_parametres.rb', line 22 def self.parse(style_tag) style = StyleParametres.new style_tag.xpath('w:name').each do |name| style.name = name.attribute('val').value end style_tag.xpath('w:qFormat').each do |q_format| next if q_format.attribute('val').nil? next if q_format.attribute('val').value == false || q_format.attribute('val').value == 'off' || q_format.attribute('val').value == '0' style.q_format = true end style end |
Instance Method Details
#==(other) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/style_parametres.rb', line 12 def ==(other) all_instance_variables = instance_variables all_instance_variables.each do |current_attributes| unless instance_variable_get(current_attributes) == other.instance_variable_get(current_attributes) return false end end true end |