add polyfill for ruby 1.9.3. struct

This commit is contained in:
Dominik Richter 2016-05-13 11:52:05 +02:00
parent dde4433933
commit 2323ec52d2
2 changed files with 14 additions and 0 deletions

13
lib/inspec/polyfill.rb Normal file
View file

@ -0,0 +1,13 @@
# encoding: utf-8
# copyright: 2016, Chef Software Inc.
# author: Dominik Richter
# author: Christoph Hartmann
# license: All rights reserved
class Struct
unless instance_methods.include? :to_h
def to_h
Hash[each_pair.to_a]
end
end
end

View file

@ -4,6 +4,7 @@
# author: Christoph Hartmann
require 'forwardable'
require 'inspec/polyfill'
require 'inspec/fetcher'
require 'inspec/source_reader'
require 'inspec/metadata'