Sha256: bf143300c30c32f9035fbf9c4af767b80c5ab7aab7698bba0543f48eefbe43ff

Contents?: true

Size: 268 Bytes

Versions: 4

Compression:

Stored size: 268 Bytes

Contents

module AttributeHelper
  def attributes=(hash)
    hash.each do |key, value|
      instance_variable_set("@#{key}", value)
    end
  end

  def attributes
    Hash[instance_variables.map { |name| [name.to_s[1..-1], instance_variable_get(name)] }]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blabla_client-0.0.4 lib/blabla_client/attribute_helper.rb
blabla_client-0.0.3 lib/blabla_client/attribute_helper.rb
blabla_client-0.0.2 lib/blabla_client/attribute_helper.rb
blabla_client-0.0.1 lib/blabla_client/attribute_helper.rb