Module: Fog::Proxmox::Variables
- Defined in:
- lib/fog/proxmox/variables.rb
Overview
module Variables mixins
Class Method Summary collapse
Class Method Details
.to_hash(instance, prefix) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/fog/proxmox/variables.rb', line 30 def self.to_hash(instance, prefix) hash = {} instance.instance_variables.select { |variable| variable.to_s.start_with? '@' + prefix }.each do |param| name = param.to_s[1..-1] hash.store(name.to_sym, instance.instance_variable_get(param)) end hash end |
.to_variables(instance, hash, prefix) ⇒ Object
24 25 26 27 28 |
# File 'lib/fog/proxmox/variables.rb', line 24 def self.to_variables(instance, hash, prefix) hash.select { |key| key.to_s.start_with? prefix }.each do |key, value| instance.instance_variable_set "@#{key}".to_sym, value end end |