Class: Pandoku::Format
- Inherits:
-
Object
- Object
- Pandoku::Format
- Defined in:
- lib/pandoku/format.rb,
lib/pandoku/lookup_table.rb
Overview
Abstract base class for formats.
Direct Known Subclasses
Pandoku::Formats::ConTeXt, Pandoku::Formats::DocBook, Pandoku::Formats::HTML, Pandoku::Formats::LaTeX, Pandoku::Formats::Man, Pandoku::Formats::Markdown, Pandoku::Formats::MediaWiki, Pandoku::Formats::ODT, Pandoku::Formats::OpenDocument, Pandoku::Formats::ReStructuredText, Pandoku::Formats::RichTextFormat, Pandoku::Formats::S5, Pandoku::Formats::Texinfo
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #cliopts ⇒ Object
-
#initialize(options = {}) ⇒ Format
constructor
A new instance of Format.
Constructor Details
#initialize(options = {}) ⇒ Format
Returns a new instance of Format.
18 19 20 21 22 |
# File 'lib/pandoku/format.rb', line 18 def initialize( = {}) @options = self.class. keys = @options.keys @options.merge!(Hash[.select {|k, v| keys.include?(k) }]) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/pandoku/format.rb', line 7 def @options end |
Class Method Details
.default_options ⇒ Object
14 15 16 |
# File 'lib/pandoku/format.rb', line 14 def self. {} end |
.inherited(subclass) ⇒ Object
26 27 28 |
# File 'lib/pandoku/lookup_table.rb', line 26 def self.inherited(subclass) Formats::LOOKUP_TABLE << subclass end |
.name ⇒ Object
9 10 11 12 |
# File 'lib/pandoku/format.rb', line 9 def self.name raise NotImplementedError, 'Format.name should be overrided to return Symbol' end |
Instance Method Details
#cliopts ⇒ Object
24 25 26 27 28 |
# File 'lib/pandoku/format.rb', line 24 def cliopts self..select {|k, v| v } \ .collect {|p| %<--#{p[0].to_s.gsub('_', '-')}> + (p[1] != true ? %<=#{p[1]}> : '') } end |