Sha256: 268b7a0d49da38569cb9d71928de5f7fcf51ffd69cd31bcf4777500bb477690c

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

module HumanAttributes
  module Error
    class NotImplemented < RuntimeError
      def initialize
        super("formatter not implemented")
      end
    end

    class InvalidHumanizeConfig < RuntimeError
      def initialize
        super("humanize options needs to be a Hash")
      end
    end

    class NotEnumerizeAttribute < RuntimeError
      def initialize
        super("needs to be an Enumerize::Value object")
      end
    end

    class NotEnumAttribute < RuntimeError
      def initialize
        super("needs to be a Rails Enum")
      end
    end

    class MissingFormatterOption < RuntimeError
      def initialize
        super("custom type needs formatter option with a proc")
      end
    end

    class InvalidType < RuntimeError
      def initialize
        types = HumanAttributes::Config::TYPES.map { |t| t[:name] }
        super("type needs to be one of: #{types.join(', ')}")
      end
    end

    class RequiredAttributeType < RuntimeError
      def initialize
        super("type is required")
      end
    end

    class InvalidAttributeOptions < RuntimeError
      def initialize
        super("options needs to be a Hash")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
human_attributes-1.1.0 lib/human_attributes/errors.rb
human_attributes-1.0.0 lib/human_attributes/errors.rb
human_attributes-0.7.1 lib/human_attributes/errors.rb