Class: Jekyll::Drivers::YamlDriver

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/drivers/yaml_driver.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ YamlDriver

Returns a new instance of YamlDriver.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/jekyll/drivers/yaml_driver.rb', line 6

def initialize(options)
  @path = options['path']

  if !@path
    raise FatalException.new "'path' must be specified for yaml data source: #{options['name']}."
  end

  if !File.exists?(@path)
    raise FatalException.new "the file '#{@path}' doesn't exist for data source '#{options['name']}'"
  end
end

Instance Method Details

#loadObject



18
19
20
# File 'lib/jekyll/drivers/yaml_driver.rb', line 18

def load
  YAML.safe_load_file(@path)
end