Sha256: e25ad4b00bfd7e6413c2895a0ea5d6845267681320d3d232ddd364627338075d

Contents?: true

Size: 866 Bytes

Versions: 9

Compression:

Stored size: 866 Bytes

Contents

module Foobara
  module BuiltinTypes
    module Model
      module Validators
        class AttributesDeclaration < TypeDeclarations::Processor
          class << self
            def requires_parent_declaration_data?
              true
            end

            def requires_declaration_data?
              false
            end
          end

          def always_applicable?
            true
          end

          def process_value(model_instance)
            Outcome.new(result: model_instance, errors: model_instance.validation_errors)
          end

          def possible_errors
            model_class_name = parent_declaration_data[:model_class]

            if model_class_name
              Object.const_get(model_class_name).possible_errors
            else
              super
            end
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
foobara-0.0.47 projects/model/src/extensions/builtin_types/model/validators/attributes_declaration.rb
foobara-0.0.46 projects/model/src/extensions/builtin_types/model/validators/attributes_declaration.rb
foobara-0.0.45 projects/model/src/extensions/builtin_types/model/validators/attributes_declaration.rb
foobara-0.0.44 projects/model/src/extensions/builtin_types/model/validators/attributes_declaration.rb
foobara-0.0.43 projects/model/src/extensions/builtin_types/model/validators/attributes_declaration.rb
foobara-0.0.42 projects/model/src/extensions/builtin_types/model/validators/attributes_declaration.rb
foobara-0.0.41 projects/model/src/extensions/builtin_types/model/validators/attributes_declaration.rb
foobara-0.0.40 projects/model/src/extensions/builtin_types/model/validators/attributes_declaration.rb
foobara-0.0.39 projects/model/src/extensions/builtin_types/model/validators/attributes_declaration.rb