Sha256: 365d74e37df3e82abc88ca52460c1f29aaa63b2af6e1d49671bf06a30a8993ae

Contents?: true

Size: 679 Bytes

Versions: 23

Compression:

Stored size: 679 Bytes

Contents

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

      def initialize(message: nil, symbol: nil, context: nil, 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
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
foobara-0.0.23 projects/value/src/data_error.rb
foobara-0.0.22 projects/value/src/data_error.rb
foobara-0.0.21 projects/value/src/data_error.rb
foobara-0.0.20 projects/value/src/data_error.rb
foobara-0.0.19 projects/value/src/data_error.rb
foobara-0.0.18 projects/value/src/data_error.rb
foobara-0.0.17 projects/value/src/data_error.rb
foobara-0.0.16 projects/value/src/data_error.rb
foobara-0.0.15 projects/value/src/data_error.rb
foobara-0.0.14 projects/value/src/data_error.rb
foobara-0.0.13 projects/value/src/data_error.rb
foobara-0.0.12 projects/value/src/data_error.rb
foobara-0.0.11 projects/value/src/data_error.rb
foobara-0.0.10 projects/value/src/data_error.rb
foobara-0.0.9 projects/value/src/data_error.rb
foobara-0.0.8 projects/value/src/data_error.rb
foobara-0.0.7 projects/value/src/data_error.rb
foobara-0.0.6 projects/value/src/data_error.rb
foobara-0.0.5 projects/value/src/data_error.rb
foobara-0.0.4 projects/value/src/data_error.rb