Sha256: c520ed1cc8c98b8705accf16768fb686d70af5f5cd94345a2cb4fd442cb09a4f

Contents?: true

Size: 332 Bytes

Versions: 1

Compression:

Stored size: 332 Bytes

Contents

module Outreach
  module Model
    private

    def to_ostruct(hash)
      o = OpenStruct.new(hash)
      hash.each.with_object(o) do |(k, v), o|
        o.send(:"#{k}=", to_ostruct(v)) if v.is_a? Hash
      end
      o
    end

    def nested_hash_value(attrs, keys)
      keys.reduce(attrs) { |m, k| m && m[k] }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
outreach-ruby-0.0.2 lib/outreach-ruby/model.rb