Sha256: 9b22dd9757f9e0b13ef796773e2c5cad5372b34458381b790fa773bd4d2e9c2c

Contents?: true

Size: 860 Bytes

Versions: 1

Compression:

Stored size: 860 Bytes

Contents

class Hyde
class Config < OpenStruct
  DEFAULTS = {
    :site_path => '.',
    :layouts_path => 'layouts',
    :extensions_path => nil,
    :partials_path => 'partials',
    :output_path => 'public'
  }

  def self.load(config_file)
    new(YAML::load_file(config_file)) rescue new
  end

  def initialize(options={})
    super DEFAULTS.merge(options)
  end

  # Returns tilt options for a given file.
  # @example tilt_options('index.haml')  # { :escape_html => ... }
  def tilt_options_for(file)
    tilt_options file.split('.').last.downcase
  end

  # Returns tilt options for a given engine.
  # @example tilt_options('haml')  # { :escape_html => ... }
  def tilt_options(what)
    @tilt_options ||= begin
      o = @table[:tilt_options] || Hash.new
      o['haml'] ||= { :escape_html => true }
      o
    end

    @tilt_options[what.to_s]
  end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hydeweb-0.1.0 lib/hyde/config.rb