Class: GEPUB::Rendition

Inherits:
Object
  • Object
show all
Defined in:
lib/gepub/rendition.rb

Defined Under Namespace

Classes: NilContent

Instance Method Summary collapse

Constructor Details

#initializeRendition

Returns a new instance of Rendition


9
10
11
12
13
14
15
16
# File 'lib/gepub/rendition.rb', line 9

def initialize()
  @default_layout = 'reflowable'
  @default_orientation = 'auto'
  @default_spread = 'auto'
  @layout = NilContent
  @orientation = NilContent
  @spread = NilContent
end

Instance Method Details

#layoutObject


33
34
35
# File 'lib/gepub/rendition.rb', line 33

def layout
  @layout.content || @default_layout
end

#orientationObject


37
38
39
# File 'lib/gepub/rendition.rb', line 37

def orientation
  @orientation.content || @default_orientation
end

#set_metadata(metadata) ⇒ Object


18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gepub/rendition.rb', line 18

def ()
  @metadata = 
  @metadata.meta_list.each {
    |metanode|
    case metanode['property']
    when 'rendition:layout'
      @layout = metanode
    when 'rendition:orientation'          
      @orientation = metanode
    when 'rendition:spread'
      @spread = metanode
    end
  }
end

#spreadObject


41
42
43
# File 'lib/gepub/rendition.rb', line 41

def spread
  @spread.content || @default_spread
end

#value_mapObject


45
46
47
# File 'lib/gepub/rendition.rb', line 45

def value_map
  { 'layout' => layout, 'orientation' => orientation, 'spread' => spread }
end