Class: Docxer::Word::Contents::Image
- Inherits:
-
Object
- Object
- Docxer::Word::Contents::Image
- Defined in:
- lib/docxer/word/contents/image.rb
Instance Attribute Summary collapse
-
#media ⇒ Object
Returns the value of attribute media.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(media, options = {}) ⇒ Image
constructor
A new instance of Image.
- #render(xml) ⇒ Object
- #styles ⇒ Object
Constructor Details
#initialize(media, options = {}) ⇒ Image
Returns a new instance of Image.
8 9 10 11 12 |
# File 'lib/docxer/word/contents/image.rb', line 8 def initialize(media, ={}) @media = media @media.file.rewind @options = end |
Instance Attribute Details
#media ⇒ Object
Returns the value of attribute media.
7 8 9 |
# File 'lib/docxer/word/contents/image.rb', line 7 def media @media end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/docxer/word/contents/image.rb', line 7 def @options end |
Instance Method Details
#render(xml) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/docxer/word/contents/image.rb', line 20 def render(xml) xml['w'].r do xml['w'].rPr do xml['w'].noProof end xml['w'].pict do xml['v'].shape( 'id' => @media.uniq_id, 'type' => @media.type, 'style' => styles ) do xml['v'].imagedata( 'r:id' => @media.sequence, 'o:title' => @options[:title] ) end end xml['w'].rPr do xml['w'].noProof end end end |
#styles ⇒ Object
14 15 16 17 18 |
# File 'lib/docxer/word/contents/image.rb', line 14 def styles if @options[:style] @options[:style].collect{|k, v| [k, v].join(':')}.join(';') end end |