Class: Hyde::Config
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Hyde::Config
- Defined in:
- lib/hyde/config.rb
Constant Summary collapse
- DEFAULTS =
{ :site_path => '.', :layouts_path => nil, :extensions_path => nil, :partials_path => nil, :output_path => nil }
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
-
#tilt_options(what, key = :tilt_options) ⇒ Object
Returns tilt options for a given engine.
-
#tilt_options_for(file, options) ⇒ Object
Returns tilt options for a given file.
Constructor Details
Class Method Details
.load(config_file) ⇒ Object
11 12 13 |
# File 'lib/hyde/config.rb', line 11 def self.load(config_file) new(YAML::load_file(config_file)) rescue new end |
Instance Method Details
#tilt_options(what, key = :tilt_options) ⇒ Object
Returns tilt options for a given engine.
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/hyde/config.rb', line 32 def (what, key=:tilt_options) @table[key] ||= begin h = Hash.new { |h, k| h[k] = Hash.new } h['haml'] = { :escape_html => true } h['scss'] = { :load_path => ['css'] } h['sass'] = { :load_path => ['css'] } h end @table[key][what.to_s] end |
#tilt_options_for(file, options) ⇒ Object
Returns tilt options for a given file.
23 24 25 26 27 28 |
# File 'lib/hyde/config.rb', line 23 def (file, ) ext = file.split('.').last.downcase opts = (ext) || Hash.new opts = opts.merge((ext, :tilt_build_options) || Hash.new) if [:build] opts end |