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.29 lib/inferno/entities/entity.rb
inferno_core-0.4.28 lib/inferno/entities/entity.rb
inferno_core-0.4.27 lib/inferno/entities/entity.rb
inferno_core-0.4.26 lib/inferno/entities/entity.rb
inferno_core-0.4.25 lib/inferno/entities/entity.rb
inferno_core-0.4.24 lib/inferno/entities/entity.rb
inferno_core-0.4.23 lib/inferno/entities/entity.rb
inferno_core-0.4.22 lib/inferno/entities/entity.rb
inferno_core-0.4.21 lib/inferno/entities/entity.rb
inferno_core-0.4.20 lib/inferno/entities/entity.rb
inferno_core-0.4.19 lib/inferno/entities/entity.rb
inferno_core-0.4.18 lib/inferno/entities/entity.rb
inferno_core-0.4.17 lib/inferno/entities/entity.rb
inferno_core-0.4.16 lib/inferno/entities/entity.rb
inferno_core-0.4.15 lib/inferno/entities/entity.rb
inferno_core-0.4.14 lib/inferno/entities/entity.rb
inferno_core-0.4.13 lib/inferno/entities/entity.rb
inferno_core-0.4.12 lib/inferno/entities/entity.rb
inferno_core-0.4.11 lib/inferno/entities/entity.rb
inferno_core-0.4.10 lib/inferno/entities/entity.rb