Class: Bookit::Emitter::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/bookit/emitter/base.rb,
lib/bookit/emitter/abstract.rb

Direct Known Subclasses

Epub, Mobi, Pdf

Constant Summary collapse

DEFAULT_OPTIONS =
{
  font_size: 12,
  
  header_size: 20,
  header_style: :bold,

  subtitle_size: 10,
  subtitle_style: :italic
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(article, options = {}) ⇒ Abstract

Returns a new instance of Abstract.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bookit/emitter/base.rb', line 16

def initialize(article, options={})
  @article = article
  @options = DEFAULT_OPTIONS.merge(options)
  
  # have all our type renderers raise an error unless defined in the subclass.
  Bookit::Content::TYPES.each do |type|
    define_method "render_#{type}".to_sym do
      raise_abstract
    end
  end

end

Instance Attribute Details

#articleObject

Returns the value of attribute article.



4
5
6
# File 'lib/bookit/emitter/base.rb', line 4

def article
  @article
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/bookit/emitter/base.rb', line 4

def options
  @options
end