Created
April 26, 2013 18:35
-
-
Save parkr/5469410 to your computer and use it in GitHub Desktop.
Jekyll::Site#initialize refactor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Jekyll | |
| class Site | |
| attr_accessor :config, :layouts, :posts, :pages, :static_files, | |
| :categories, :exclude, :include, :source, :dest, :lsi, :pygments, | |
| :permalink_style, :tags, :time, :future, :safe, :plugins, :limit_posts, | |
| :show_drafts, :keep_files, :baseurl | |
| attr_accessor :converters, :generators | |
| # Public: Initialize a new Site. | |
| # | |
| # config - A Hash containing site configuration details. | |
| def initialize(config) | |
| self.config = config.clone | |
| config['source'] = File.expand_path(config['source']) | |
| config['destination'] = File.expand_path(config['destination']) | |
| config['permalink'] = config['permalink'].to_sym | |
| %w[safe source dest lsi pygments baseurl permalink_style exclude | |
| include future show_drafts limit_posts keep_files].each do |meth| | |
| send("#{meth}=", config[meth]) | |
| end | |
| self.reset | |
| self.setup | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's a ton of different concerns here:
There's probably more concerns than just that. Splitting them out into more classes sounds reasonable.