Sha256: cbbcad8c1f12324288d7be9f1d5bb4e18d7bfca0aae920afe1ac2cfb9ebd12e5

Contents?: true

Size: 710 Bytes

Versions: 2

Compression:

Stored size: 710 Bytes

Contents

module Foobara
  module Value
    class DataError < Error
      class << self
        def category
          :data
        end
      end

      def initialize(message: nil, symbol: nil, context: {}, path: nil)
        args = { message:, symbol:, context:, path: }.compact
        super(**args.merge(category: self.class.category))
      end

      def attribute_name
        # TODO: feels awkward... something is not right
        # how is path actually set?
        path.last || context[:attribute_name]
      end

      def eql?(other)
        # TODO: this doesn't feel right at all...
        super && other.is_a?(DataError) && path == other.path
      end
    end
  end

  DataError = Value::DataError
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foobara-0.0.27 projects/value/src/data_error.rb
foobara-0.0.26 projects/value/src/data_error.rb