Class: Docxi::Word::Themes

Inherits:
Object
  • Object
show all
Defined in:
lib/docxi/word/themes.rb,
lib/docxi/word/themes/theme.rb

Defined Under Namespace

Classes: Theme

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeThemes

Returns a new instance of Themes.



8
9
10
11
12
13
# File 'lib/docxi/word/themes.rb', line 8

def initialize
  @themes = []
  @counter = 0
  
  add(Theme.new)
end

Instance Attribute Details

#counterObject

Returns the value of attribute counter.



7
8
9
# File 'lib/docxi/word/themes.rb', line 7

def counter
  @counter
end

#themesObject

Returns the value of attribute themes.



7
8
9
# File 'lib/docxi/word/themes.rb', line 7

def themes
  @themes
end

Instance Method Details

#add(theme) ⇒ Object



15
16
17
18
19
# File 'lib/docxi/word/themes.rb', line 15

def add(theme)
  @counter += 1
  @themes << theme.set_sequence(@counter)
  theme
end

#render(zip) ⇒ Object



21
22
23
24
25
26
# File 'lib/docxi/word/themes.rb', line 21

def render(zip)
  @themes.each do |theme|
    zip.put_next_entry("word/theme/theme#{theme.sequence}.xml")
    zip.write(theme.render)
  end
end