module Wardrobe::Plugins::AliasSetters::InstanceMethods

Private Instance Methods

_attribute_init(atr, hash, name) click to toggle source
Calls superclass method
# File lib/wardrobe/plugins/alias_setters.rb, line 22
def _attribute_init(atr, hash, name)
  return super unless atr.options[:alias_setter]
  return super if atr.options[:alias_setter].empty?
  keys_in_hash = atr.options[:alias_setter].select { |key| hash.key?(key) }
  return super unless keys_in_hash.any?
  keys_in_hash.reverse.each do |key|
    send("#{name}=", atr.coerce(hash[key]))
  end
end