Class: JekyllBuildEbook::Config
- Inherits:
-
Object
- Object
- JekyllBuildEbook::Config
- Defined in:
- lib/jekyll-build-ebook/config.rb
Constant Summary collapse
- DEFAULTS =
{ 'ebook' => { 'destination' => '_ebook', }, }.freeze
Instance Method Summary collapse
- #creator ⇒ Object
- #date ⇒ Object
- #destination ⇒ Object
- #file_name ⇒ Object
- #identifier ⇒ Object
-
#initialize(config) ⇒ Config
constructor
A new instance of Config.
- #language ⇒ Object
- #layout ⇒ Object
- #page_progression_direction ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(config) ⇒ Config
Returns a new instance of Config.
11 12 13 |
# File 'lib/jekyll-build-ebook/config.rb', line 11 def initialize(config) @config = config end |
Instance Method Details
#creator ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/jekyll-build-ebook/config.rb', line 43 def creator case when !ebook['creator'].nil? ebook['creator'] when site['author'].is_a?(String) site['author'] when site['author'].is_a?(Hash) && !site['author']['name'].nil? site['author']['name'] else nil end end |
#date ⇒ Object
39 40 41 |
# File 'lib/jekyll-build-ebook/config.rb', line 39 def date ebook['date'] end |
#destination ⇒ Object
19 20 21 |
# File 'lib/jekyll-build-ebook/config.rb', line 19 def destination File.(ebook['destination']) end |
#file_name ⇒ Object
23 24 25 |
# File 'lib/jekyll-build-ebook/config.rb', line 23 def file_name "#{ebook['file_name'] || title}.epub" end |
#identifier ⇒ Object
27 28 29 |
# File 'lib/jekyll-build-ebook/config.rb', line 27 def identifier ebook['identifier'] || site['url'].nil? ? nil : "#{site['url']}#{site['base_url']}" || SecureRandom.uuid end |
#language ⇒ Object
35 36 37 |
# File 'lib/jekyll-build-ebook/config.rb', line 35 def language ebook['language'] || site['language'] || site['lang'] or raise InvalidConfigError, 'Language is required' end |
#layout ⇒ Object
15 16 17 |
# File 'lib/jekyll-build-ebook/config.rb', line 15 def layout ebook['layout'] end |
#page_progression_direction ⇒ Object
56 57 58 |
# File 'lib/jekyll-build-ebook/config.rb', line 56 def page_progression_direction ebook['page_progression_direction'] end |
#title ⇒ Object
31 32 33 |
# File 'lib/jekyll-build-ebook/config.rb', line 31 def title ebook['title'] || site['title'] or raise InvalidConfigError, 'Title is required' end |