class Mako::Configuration

Constants

DEFAULT_CONFIGURATION

Attributes

config_file[R]
destination[R]
sanitize_images[R]
source_templates[R]
theme[R]

Public Class Methods

load(file) click to toggle source

Loads default config file and attempts to merge in any user settings. Creates a new instance of Mako::Configuration.

@param [String] @return [Mako::Configuration]

# File lib/mako/configuration.rb, line 20
def self.load(file)
  begin
    user_config_yaml = load_resource(file)
  rescue SystemCallError
    config = DEFAULT_CONFIGURATION
    return new(config)
  end
  user_config = YAML.safe_load(user_config_yaml) || {}
  user_config['config_file'] = file
  config = DEFAULT_CONFIGURATION.merge(user_config)
  new(config)
end
new(args) click to toggle source
# File lib/mako/configuration.rb, line 36
def initialize(args)
  @source_templates = args.fetch('source_templates')
  @theme = args.fetch('theme')
  @destination = args.fetch('destination')
  @sanitize_images = args.fetch('sanitize_images')
  @config_file = args.fetch('config_file')
end