Class: Inferno::Entities::Entity
- Inherits:
-
Object
- Object
- Inferno::Entities::Entity
- Defined in:
- lib/inferno/entities/entity.rb
Direct Known Subclasses
Header, Message, Preset, Request, Result, SessionData, TestRun, TestSession, ValidatorSession
Instance Method Summary collapse
-
#initialize(params, attributes) ⇒ Entity
constructor
A new instance of Entity.
- #to_hash ⇒ Object
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_hash ⇒ Object
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 |