Sha256: 03b6ac87ed4a61f0e02349327cb3700b876d6a37764a5afd7f72121aa9a188f2
Contents?: true
Size: 808 Bytes
Versions: 1
Compression:
Stored size: 808 Bytes
Contents
module Fog module Associations class ManyIdentities < Default def create_setter model.class_eval <<-EOS, __FILE__, __LINE__ def #{name}=(new_#{name}) associations[:#{name}] = Array(new_#{name}).map do |association| association.respond_to?(:identity) ? association.identity : association end end EOS end def create_getter model.class_eval <<-EOS, __FILE__, __LINE__ def #{name} return [] if associations[:#{name}].nil? Array(associations[:#{name}]).map do |association| service.send(self.class.associations[:#{name}]).get(association) end end EOS end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fog-core-1.24.0 | lib/fog/core/associations/many_identities.rb |