Class: Crek::Styles

Inherits:
Object
  • Object
show all
Defined in:
lib/crek/styles.rb,
lib/crek/styles/constants.rb,
lib/crek/styles/converter.rb,
lib/crek/styles/style_types.rb

Defined Under Namespace

Modules: Constants Classes: Converter, StyleTypes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(book) ⇒ Styles

Returns a new instance of Styles.



4
5
6
# File 'lib/crek/styles.rb', line 4

def initialize(book)
  @book = book
end

Instance Attribute Details

#bookObject

Returns the value of attribute book.



3
4
5
# File 'lib/crek/styles.rb', line 3

def book
  @book
end

Instance Method Details

#pathObject



8
9
10
# File 'lib/crek/styles.rb', line 8

def path
  "xl/styles.xml"
end

#style_typesObject



21
22
23
24
25
# File 'lib/crek/styles.rb', line 21

def style_types
  @style_types ||= begin
    Crek::Styles::StyleTypes.new(styles_xml).call
  end
end

#styles_xmlObject



12
13
14
15
16
17
18
19
# File 'lib/crek/styles.rb', line 12

def styles_xml
  @styles_xml ||= begin
    if @book.files.file.exist?(path)
      doc = @book.files.file.open path
      Nokogiri::XML::Document.parse doc
    end
  end
end