module PDC::Resource::AttributeModifier
Public Class Methods
new(attrs = {}) { |self| ... }
click to toggle source
Calls superclass method
# File lib/pdc/resource/attribute_modifier.rb, line 19 def initialize(attrs = {}) super self.class.attribute_modifications.each do |what, *args| case what when :rename apply_attr_rename(*args) else PDC.logger.warn "Invalid attribute transformation #{what}: #{from} #{to}" end end yield self if block_given? end
Private Instance Methods
apply_attr_rename(from, to)
click to toggle source
# File lib/pdc/resource/attribute_modifier.rb, line 35 def apply_attr_rename(from, to) if attributes.key?(from) && !attributes.key?(to) attributes[to] = attributes.delete(from) else PDC.logger.info "rename: not applied for from: #{from}, to: #{to} | #{attributes}" end end