Module: Fog::Hyperv
- Extended by:
- Provider
- Defined in:
- lib/fog/hyperv.rb,
lib/fog/hyperv/model.rb,
lib/fog/hyperv/compute.rb,
lib/fog/hyperv/version.rb,
lib/fog/hyperv/constants.rb,
lib/fog/hyperv/collection.rb
Defined Under Namespace
Modules: Associations, Errors, ModelExtends, ModelIncludes, Utils Classes: Collection, Compute, Model
Constant Summary collapse
- VERSION =
The Fog Hyper-V version
'0.1.0'- GUID =
General GUID format matching the UUIDv4 specification
/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}/i- ON_OFF_STATE_ENUM_VALUES =
Note:
Defined by Microsoft.HyperV.PowerShell.OnOffState
General enum for on/off toggles as used by Hyper-V
%i[ On Off ].freeze
- BOOT_DEVICE_ENUM_VALUES =
Note:
Defined by Microsoft.HyperV.PowerShell.BootDevice
Possible boot devices
A few values -
:VHDand:IDE,:NetworkAdapterand:LegacyNetworkAdapter- refer to the same actual value, but will be used depending on the generation of the VM. %i[ Floppy CD IDE LegacyNetworkAdapter NetworkAdapter VHD ].freeze
Class Method Summary collapse
-
.camelize(data) ⇒ Object
Convert a piece of data from being snake_case to being CamelCase.
-
.uncamelize(data) ⇒ Object
Convert a piece of data from being CamelCase to being snake_case.
Class Method Details
.camelize(data) ⇒ Object
Convert a piece of data from being snake_case to being CamelCase
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/fog/hyperv.rb', line 88 def self.camelize(data) case data when Array data.collect { |d| camelize(d) } when Hash data.each_with_object({}) do |(k, v), hash| value = v value = camelize(v) if v.is_a?(Hash) || (v.is_a?(Array) && v.all?(Hash)) hash[camelize(k)] = value end when Symbol camelize(data.to_s).to_sym when String data.split('_').collect(&:capitalize).join else data end end |
.uncamelize(data) ⇒ Object
Convert a piece of data from being CamelCase to being snake_case
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/fog/hyperv.rb', line 108 def self.uncamelize(data) case data when Array data.collect { |d| uncamelize(d) } when Hash data.each_with_object({}) do |(k, v), hash| value = v value = uncamelize(v) if v.is_a?(Hash) || (v.is_a?(Array) && v.all?(Hash)) hash[uncamelize(k)] = value end when Symbol uncamelize(data.to_s).to_sym when String data.to_s .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .tr('-', '_') .downcase.to_sym else data end end |