Class: Rubyword::Writer::Style::Word
- Defined in:
- lib/rubyword/writer/style/word.rb
Constant Summary collapse
- WordStyleList =
{ font_size: 'w:sz', color: 'w:color', underline: 'w:u', blod: 'w:b', all_caps: 'w:caps', italic: 'w:i', bgcolor: 'w:highlight' }.freeze
Instance Attribute Summary
Attributes inherited from Base
#rubyword, #section, #style, #xml
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Rubyword::Writer::Style::Base
Instance Method Details
#write(style) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rubyword/writer/style/word.rb', line 16 def write(style) if !style.nil? && style.is_a?(Hash) @xml.send('w:rPr') { style.keys.each do |style_name| style_name = style_name.to_sym if WordStyleList.keys.include?(style_name) value = style[style_name] attribute = if !!value != value # not a bool type {'w:val' => value} else nil end doc_style = WordStyleList[style_name] @xml.send(doc_style, attribute) @xml.send('w:szCs', attribute) if style_name == :font_size end end } end end |