Class: GEPUB::Rendition
- Inherits:
-
Object
- Object
- GEPUB::Rendition
- Defined in:
- lib/gepub/rendition.rb
Defined Under Namespace
Classes: NilContent
Instance Method Summary collapse
-
#initialize ⇒ Rendition
constructor
A new instance of Rendition.
- #layout ⇒ Object
- #orientation ⇒ Object
- #set_metadata(metadata) ⇒ Object
- #spread ⇒ Object
- #value_map ⇒ Object
Constructor Details
#initialize ⇒ Rendition
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
#layout ⇒ Object
33 34 35 |
# File 'lib/gepub/rendition.rb', line 33 def layout @layout.content || @default_layout end |
#orientation ⇒ Object
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..each { || case ['property'] when 'rendition:layout' @layout = when 'rendition:orientation' @orientation = when 'rendition:spread' @spread = end } end |
#spread ⇒ Object
41 42 43 |
# File 'lib/gepub/rendition.rb', line 41 def spread @spread.content || @default_spread end |
#value_map ⇒ Object
45 46 47 |
# File 'lib/gepub/rendition.rb', line 45 def value_map { 'layout' => layout, 'orientation' => orientation, 'spread' => spread } end |