Sha256: 2b64c28de68c01a0fbcc52f1001e7292a9d4deb7e43299e446e47418d4948620

Contents?: true

Size: 368 Bytes

Versions: 93

Compression:

Stored size: 368 Bytes

Contents

module Inferno
  module Entities
    class Entity
      def initialize(params, attributes)
        attributes.each { |name| instance_variable_set("@#{name}", params[name]) }
      end

      def to_hash
        self.class::ATTRIBUTES.each_with_object({}) do |attribute, hash|
          hash[attribute] = send(attribute)
        end.compact
      end
    end
  end
end

Version data entries

93 entries across 93 versions & 1 rubygems

Version Path
inferno_core-0.1.1.pre lib/inferno/entities/entity.rb
inferno_core-0.1.0 lib/inferno/entities/entity.rb
inferno_core-0.1.0.pre lib/inferno/entities/entity.rb
inferno_core-0.0.8 lib/inferno/entities/entity.rb
inferno_core-0.0.8.pre2 lib/inferno/entities/entity.rb
inferno_core-0.0.8.pre lib/inferno/entities/entity.rb
inferno_core-0.0.7 lib/inferno/entities/entity.rb
inferno_core-0.0.6 lib/inferno/entities/entity.rb
inferno_core-0.0.5 lib/inferno/entities/entity.rb
inferno_core-0.0.4 lib/inferno/entities/entity.rb
inferno_core-0.0.3 lib/inferno/entities/entity.rb
inferno_core-0.0.2 lib/inferno/entities/entity.rb
inferno_core-0.0.1 lib/inferno/entities/entity.rb