Class: Inferno::Entities::Entity

Inherits:
Object
  • Object
show all
Defined in:
lib/inferno/entities/entity.rb

Instance Method Summary collapse

Constructor Details

#initialize(params, attributes) ⇒ Entity

Returns a new instance of Entity.



4
5
6
# File 'lib/inferno/entities/entity.rb', line 4

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

Instance Method Details

#to_hashObject



8
9
10
11
12
# File 'lib/inferno/entities/entity.rb', line 8

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