Sha256: c8a7487d755d03506cf5ee01b4eb7803aa20e3e114c3514e588ba4940c980a6b

Contents?: true

Size: 578 Bytes

Versions: 1

Compression:

Stored size: 578 Bytes

Contents

module Motr #:nodoc
  module Errors #:nodoc

    # Default parent Motr error for all custom errors. This handles the base
    # key for the translations and provides the convenience method for
    # translating the messages.
    class MotrError < StandardError
      BASE_KEY = "motr.errors"
      ##
      # Translate an error message
      # @param [String] key The i18n message key
      # @param [Hash] options Options to pass to the i18n library
      # 
      def translate(key, options)
        ::I18n.translate("#{BASE_KEY}.#{key}", options)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
motr-0.0.1 lib/motr/errors/motr_error.rb