Class: Dimples::Configuration
- Inherits:
-
Object
- Object
- Dimples::Configuration
- Defined in:
- lib/dimples/configuration.rb
Overview
A class that models a site’s configuration.
Class Method Summary collapse
- .default_date_formats ⇒ Object
- .default_generation ⇒ Object
- .default_layouts ⇒ Object
- .default_pagination ⇒ Object
- .default_paths ⇒ Object
- .default_settings ⇒ Object
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(config = {}) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(config = {}) ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 |
# File 'lib/dimples/configuration.rb', line 6 def initialize(config = {}) @settings = Configuration.default_settings.merge(config) end |
Class Method Details
.default_date_formats ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/dimples/configuration.rb', line 66 def self.default_date_formats { year: '%Y', month: '%Y-%m', day: '%Y-%m-%d' } end |
.default_generation ⇒ Object
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/dimples/configuration.rb', line 55 def self.default_generation { categories: true, year_archives: true, month_archives: true, day_archives: true, feeds: true, category_feeds: true } end |
.default_layouts ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/dimples/configuration.rb', line 30 def self.default_layouts { posts: 'posts', post: 'post', category: 'category', year_archives: 'year_archives', month_archives: 'month_archives', day_archives: 'day_archives' } end |
.default_pagination ⇒ Object
49 50 51 52 53 |
# File 'lib/dimples/configuration.rb', line 49 def self.default_pagination { per_page: 10 } end |
.default_paths ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/dimples/configuration.rb', line 41 def self.default_paths { archives: 'archives', posts: 'archives/%Y/%m/%d', categories: 'archives/categories' } end |
.default_settings ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/dimples/configuration.rb', line 14 def self.default_settings { source_path: Dir.pwd, destination_path: File.join(Dir.pwd, 'site'), verbose_logging: false, class_overrides: { site: nil, post: nil }, rendering: {}, category_names: {}, paths: default_paths, layouts: default_layouts, pagination: default_pagination, generation: default_generation, date_formats: default_date_formats } end |
Instance Method Details
#[](key) ⇒ Object
10 11 12 |
# File 'lib/dimples/configuration.rb', line 10 def [](key) @settings[key] end |