Sha256: 20b1bfc3911ecfa4bbc182df897105a799dd79ce86a88ada6b2efbef33407c9a

Contents?: true

Size: 426 Bytes

Versions: 2

Compression:

Stored size: 426 Bytes

Contents

module Ucasy::Validators
  class RequiredAttributes < Ucasy::Callable
    def initialize(context, required_attributes)
      @context = context
      @required_attributes = required_attributes
    end

    def call
      @required_attributes.each do |attribute|
        next if @context.respond_to?(attribute)

        raise ArgumentError, "You must set '#{attribute}' variable in '#{self.class}'"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ucasy-0.0.5 lib/ucasy/validators/required_attributes.rb
ucasy-0.0.4 lib/ucasy/validators/required_attributes.rb