Sha256: 0b9780a5b3a2ccbdf5fb2e3fec75e34c5353b993f232d5c55edf5f8f1ddb18ac

Contents?: true

Size: 511 Bytes

Versions: 2

Compression:

Stored size: 511 Bytes

Contents

require 'safe_yaml'

module Monad
  module Drivers
    class YamlDriver
      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

      def load
        YAML.safe_load_file(@path)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
monad-0.0.2 lib/monad/drivers/yaml_driver.rb
monad-0.0.1 lib/monad/drivers/yaml_driver.rb