zeisler/active_mocker

View on GitHub
lib/active_mocker/mock/alias_attribute.rb

Summary

Maintainability
A
0 mins
Test Coverage
module ActiveMocker
  module AliasAttribute
    # Is +new_name+ an alias?
    def attribute_alias?(new_name)
      attribute_aliases.key? new_name.to_s
    end

    # Returns the original name for the alias +name+
    def attribute_alias(name)
      attribute_aliases[name.to_s]
    end

    private

    def attribute_aliases
      @attribute_aliases ||= {}
    end
  end
end