Sha256: 745557541372c8fa7bec722cd2fb579dbd0fd819135606cce502c4a7981fb74c

Contents?: true

Size: 444 Bytes

Versions: 2

Compression:

Stored size: 444 Bytes

Contents

module Activite
  class Base
    # @return [Hash]
    attr_reader :attrs

    # Initializes a new object with attributes for the values passed to the constructor.
    #
    # @param attrs [Hash]
    # @return [Activite::Base]
    def initialize(attrs = {})
      @attrs = attrs || {}
      @attrs.each do |key, value|
        self.class.class_eval { attr_reader key }
        instance_variable_set("@#{key}", value)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activite-0.2.0 lib/activite/base.rb
activite-0.1.0 lib/activite/base.rb