Sha256: 737484ea8345ea9d41966e066df0b2748cff97ca43f0132ffd76f3d3658243b3

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 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 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

6 entries across 6 versions & 1 rubygems

Version Path
human_attributes-0.7.0 lib/human_attributes/errors.rb
human_attributes-0.6.0 lib/human_attributes/errors.rb
human_attributes-0.5.0 lib/human_attributes/errors.rb
human_attributes-0.4.0 lib/human_attributes/errors.rb
human_attributes-0.3.1 lib/human_attributes/errors.rb
human_attributes-0.3.0 lib/human_attributes/errors.rb