module Hashie::Extensions::Dash::PropertyTranslation::InstanceMethods

def []=(property, value)

Note: Only works on pre-existing properties.

Sets a value on the Dash in a Hash-like way.
def []=(property, value)
  if self.class.translation_exists? property
    send("#{property}=", value)
    if self.class.transformation_exists? property
      super property, self.class.transformed_property(property, value)
    elsif self.class.properties.include?(property)
      super(property, value)
    end
  elsif self.class.transformation_exists? property
    super property, self.class.transformed_property(property, value)
  elsif property_exists? property
    super
  end
end

def __translations

def __translations
  self.class.translations_hash
end

def initialize_attributes(attributes)

Deletes any keys that have a translation
def initialize_attributes(attributes)
  return unless attributes
  attributes_copy = attributes.dup.delete_if do |k, v|
    if self.class.translations_hash.include?(k)
      self[k] = v
      true
    end
  end
  super attributes_copy
end

def property_exists?(property)

Raises an NoMethodError if the property doesn't exist
def property_exists?(property)
  fail_no_property_error!(property) unless self.class.property?(property)
  true
end