module Fog::Proxmox::Variables
module Variables
mixins
Public Class Methods
to_hash(instance, prefix)
click to toggle source
# 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)
click to toggle source
# 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