Module: Fog::Kubevirt::Compute::Shared
Defined Under Namespace
Classes: EntityCollection, ExceptionWrapper
Constant Summary collapse
- OS_LABEL =
Label name which identifies operation system information
'kubevirt.io/os'.freeze
- OS_LABEL_SYMBOL =
:'kubevirt.io/os'
Instance Method Summary collapse
-
#deep_merge!(source_hash, other_hash, &block) ⇒ Object
Copied from rails: File activesupport/lib/active_support/core_ext/hash/deep_merge.rb, line 21 The method was changed to look like this in v4.0.0 of rails.
-
#object_to_hash(object) ⇒ Object
converts kubeclient objects into hash for fog to consume.
Instance Method Details
#deep_merge!(source_hash, other_hash, &block) ⇒ Object
Copied from rails: File activesupport/lib/active_support/core_ext/hash/deep_merge.rb, line 21 The method was changed to look like this in v4.0.0 of rails
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/fog/kubevirt/compute/compute.rb', line 141 def deep_merge!(source_hash, other_hash, &block) other_hash.each_pair do |current_key, other_value| this_value = source_hash[current_key] source_hash[current_key] = if this_value.is_a?(Hash) && other_value.is_a?(Hash) this_value = deep_merge!(this_value, other_value, &block) else if block_given? && key?(current_key) block.call(current_key, this_value, other_value) else other_value end end end source_hash end |
#object_to_hash(object) ⇒ Object
converts kubeclient objects into hash for fog to consume
123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/fog/kubevirt/compute/compute.rb', line 123 def object_to_hash(object) result = object case result when OpenStruct result = result.marshal_dump result.each do |k, v| result[k] = object_to_hash(v) end when Array result = result.map { |v| object_to_hash(v) } end result end |