Class: RubyDocx::Convertor::Html::Base
- Inherits:
-
Object
- Object
- RubyDocx::Convertor::Html::Base
- Defined in:
- lib/ruby_docx/convertors/elements/html/base.rb
Instance Attribute Summary collapse
-
#css ⇒ Object
readonly
Returns the value of attribute css.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
- #build ⇒ Object
- #convert ⇒ Object
-
#initialize(tag, css) ⇒ Base
constructor
A new instance of Base.
- #styles ⇒ Object
Constructor Details
#initialize(tag, css) ⇒ Base
Returns a new instance of Base.
4 5 6 7 |
# File 'lib/ruby_docx/convertors/elements/html/base.rb', line 4 def initialize(tag, css) @tag = tag @css = css end |
Instance Attribute Details
#css ⇒ Object (readonly)
Returns the value of attribute css.
3 4 5 |
# File 'lib/ruby_docx/convertors/elements/html/base.rb', line 3 def css @css end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
3 4 5 |
# File 'lib/ruby_docx/convertors/elements/html/base.rb', line 3 def tag @tag end |
Instance Method Details
#build ⇒ Object
9 10 11 12 13 |
# File 'lib/ruby_docx/convertors/elements/html/base.rb', line 9 def build node = convert node.add_styles(styles) if styles.present? node end |
#convert ⇒ Object
15 16 17 |
# File 'lib/ruby_docx/convertors/elements/html/base.rb', line 15 def convert RubyDocx::InextensibleBlock.new end |
#styles ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ruby_docx/convertors/elements/html/base.rb', line 19 def styles @styles = {} eval_styles.reverse.each do |row| prop, val = row.split(':', 2).map(&:strip) unless @styles.has_key? prop @styles[prop] = val.sub /;$/, '' end end @styles end |