Sha256: 60218673b93bc158f0de1b622aaddc6b1589646e4ad230010ead958e12e1d57f

Contents?: true

Size: 472 Bytes

Versions: 4

Compression:

Stored size: 472 Bytes

Contents

module Orias
  # Base Orias class
  #
  class Base
    def initialize(attributes = {})
      _assign_attributes(attributes)
    end

    private

    def _assign_attributes(attributes)
      attributes.each do |key, value|
        _assign_attribute(key, value)
      end
    end

    def _assign_attribute(key, value)
      setter = :"#{key}="
      raise UnknownAttributeError.new(self, key) unless respond_to?(setter)

      public_send(setter, value)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
orias-0.4.1 lib/orias/base.rb
orias-0.4 lib/orias/base.rb
orias-0.3.0 lib/orias/base.rb
orias-0.2.0 lib/orias/base.rb