Sha256: 4c7442b1669d2535921ea578ee1edc1166d2a6216528317d29f04274911accb9

Contents?: true

Size: 401 Bytes

Versions: 5

Compression:

Stored size: 401 Bytes

Contents

module Kagu

  module AttributesInitializer

    def initialize(attributes = {})
      attributes.each do |name, value|
        send("#{name}=", value) if respond_to?("#{name}=", true)
      end
      self.class.const_get(:MANDATORY_ATTRIBUTES).each do |attribute|
        raise Error.new("#{self.class}##{attribute} is mandatory for #{inspect}") if send(attribute).nil?
      end
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kagu-4.0.0 lib/kagu/attributes_initializer.rb
kagu-3.2.0 lib/kagu/attributes_initializer.rb
kagu-3.1.0 lib/kagu/attributes_initializer.rb
kagu-3.0.10 lib/kagu/attributes_initializer.rb
kagu-3.0.9 lib/kagu/attributes_initializer.rb