Sha256: 6090a88c9162a1fcbbcab81b3efd82f8053d34ab786b8848d2482d792e1f500c

Contents?: true

Size: 487 Bytes

Versions: 5

Compression:

Stored size: 487 Bytes

Contents

# frozen_string_literal: true

module SuperSettings
  # Interface to expose mass setting attributes on an object. Setting attributes with a
  # hash will simply call the attribute writers for each key in the hash.
  module Attributes
    def initialize(attributes = nil)
      self.attributes = attributes if attributes
    end

    def attributes=(values)
      values.each do |name, value|
        send(:"#{name}=", value) if respond_to?(:"#{name}=", true)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
super_settings-2.1.0 lib/super_settings/attributes.rb
super_settings-2.0.3 lib/super_settings/attributes.rb
super_settings-2.0.2 lib/super_settings/attributes.rb
super_settings-2.0.1 lib/super_settings/attributes.rb
super_settings-2.0.0 lib/super_settings/attributes.rb