Sha256: e038a6f8100e97b21a3dc925a4176b32e7256d176d63b392531126020330c3fa

Contents?: true

Size: 1.01 KB

Versions: 32

Compression:

Stored size: 1.01 KB

Contents

module GEPUB
  class Rendition
    class NilContent
      def self.content
        nil
      end
    end
    
    def initialize()
      @default_layout = 'reflowable'
      @default_orientation = 'auto'
      @default_spread = 'auto'
      @layout = NilContent
      @orientation = NilContent
      @spread = NilContent
    end

    def set_metadata(metadata)
      @metadata = 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

    def layout
      @layout.content || @default_layout
    end

    def orientation
      @orientation.content || @default_orientation
    end

    def spread
      @spread.content || @default_spread
    end
    
    def value_map
      { 'layout' => layout, 'orientation' => orientation, 'spread' => spread }
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
gepub-1.0.16 lib/gepub/rendition.rb
gepub-1.0.15 lib/gepub/rendition.rb
gepub-1.0.14 lib/gepub/rendition.rb
gepub-1.0.13 lib/gepub/rendition.rb
gepub-1.0.12 lib/gepub/rendition.rb
gepub-1.0.11 lib/gepub/rendition.rb
gepub-1.0.10 lib/gepub/rendition.rb
gepub-1.0.9 lib/gepub/rendition.rb
gepub-1.0.8 lib/gepub/rendition.rb
gepub-1.0.7 lib/gepub/rendition.rb
gepub-1.0.6 lib/gepub/rendition.rb
gepub-1.0.5 lib/gepub/rendition.rb
gepub-1.0.4 lib/gepub/rendition.rb
gepub-1.0.3 lib/gepub/rendition.rb
gepub-1.0.2 lib/gepub/rendition.rb
gepub-1.0.1 lib/gepub/rendition.rb
gepub-1.0.0 lib/gepub/rendition.rb
gepub-1.0.0rc1 lib/gepub/rendition.rb
gepub-1.0.0beta1 lib/gepub/rendition.rb
gepub-0.7.1 lib/gepub/rendition.rb