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.6.1 lib/inferno/entities/entity.rb
inferno_core-0.6.0 lib/inferno/entities/entity.rb
inferno_core-0.5.4 lib/inferno/entities/entity.rb
inferno_core-0.5.3 lib/inferno/entities/entity.rb
inferno_core-0.5.2 lib/inferno/entities/entity.rb
inferno_core-0.5.1 lib/inferno/entities/entity.rb
inferno_core-0.5.0 lib/inferno/entities/entity.rb
inferno_core-0.4.44 lib/inferno/entities/entity.rb
inferno_core-0.4.43 lib/inferno/entities/entity.rb
inferno_core-0.4.42 lib/inferno/entities/entity.rb
inferno_core-0.4.41 lib/inferno/entities/entity.rb
inferno_core-0.4.40 lib/inferno/entities/entity.rb
inferno_core-0.4.39 lib/inferno/entities/entity.rb
inferno_core-0.4.38 lib/inferno/entities/entity.rb
inferno_core-0.4.35 lib/inferno/entities/entity.rb
inferno_core-0.4.34 lib/inferno/entities/entity.rb
inferno_core-0.4.33 lib/inferno/entities/entity.rb
inferno_core-0.4.32 lib/inferno/entities/entity.rb
inferno_core-0.4.31 lib/inferno/entities/entity.rb
inferno_core-0.4.30 lib/inferno/entities/entity.rb