Sha256: a44e2ac0c6c26209273873595775fa4ffe9cc578f4386b1245a1e407d4b72430

Contents?: true

Size: 531 Bytes

Versions: 2

Compression:

Stored size: 531 Bytes

Contents

module Middleman
  module Versions
    module FileHandler
      def self.load_file(path)
        case File.extname(path)
          when ".yml",".yaml"
            load_yaml_file path
          when ".json"
            load_json_file path
        end
      end

      private_class_method def self.load_yaml_file(path)
        require 'yaml'
        YAML::load(File.open(path))
      end

      private_class_method def self.load_json_file(path)
        require 'json'
        JSON.parse( IO.read(path))
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
middleman-versions-1.0.1 lib/middleman/versions/helpers/file_handler.rb
middleman-versions-1.0.0 lib/middleman/versions/helpers/file_handler.rb