summaryrefslogtreecommitdiff
path: root/spec/lib/utils/hash_extension.rb
blob: ba7cee6871f5d3128d4b18093112f7985f6f511b (plain)
1
2
3
4
5
6
7
module CoreExtensions
  refine Hash do
    def to_struct
      Struct.new(*self.keys).new(*self.values.map { |value| value.is_a?(Hash) ? value.to_struct : value })
    end
  end
end