Class: RubyDocx::Convertor::Html::Base
- Inherits:
-
Object
- Object
- RubyDocx::Convertor::Html::Base
show all
- Defined in:
- lib/ruby_docx/convertors/elements/html/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(tag, css) ⇒ 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
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
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
|
#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
|