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.4.9 lib/inferno/entities/entity.rb
inferno_core-0.4.8 lib/inferno/entities/entity.rb
inferno_core-0.4.7 lib/inferno/entities/entity.rb
inferno_core-0.4.7.pre lib/inferno/entities/entity.rb
inferno_core-0.4.6 lib/inferno/entities/entity.rb
inferno_core-0.4.5 lib/inferno/entities/entity.rb
inferno_core-0.4.4 lib/inferno/entities/entity.rb
inferno_core-0.4.3 lib/inferno/entities/entity.rb
inferno_core-0.4.2 lib/inferno/entities/entity.rb
inferno_core-0.4.2.pre lib/inferno/entities/entity.rb
inferno_core-0.4.1 lib/inferno/entities/entity.rb
inferno_core-0.4.1.pre2 lib/inferno/entities/entity.rb
inferno_core-0.4.1.pre lib/inferno/entities/entity.rb
inferno_core-0.4.0 lib/inferno/entities/entity.rb
inferno_core-0.3.12 lib/inferno/entities/entity.rb
inferno_core-0.3.11 lib/inferno/entities/entity.rb
inferno_core-0.3.10 lib/inferno/entities/entity.rb
inferno_core-0.3.9 lib/inferno/entities/entity.rb
inferno_core-0.3.8 lib/inferno/entities/entity.rb
inferno_core-0.3.7 lib/inferno/entities/entity.rb